summaryrefslogtreecommitdiff
path: root/tests/src/baseservices
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2016-11-23 19:09:09 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2016-11-23 19:09:09 +0900
commit4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (patch)
tree98110734c91668dfdbb126fcc0e15ddbd93738ca /tests/src/baseservices
parentfa45f57ed55137c75ac870356a1b8f76c84b229c (diff)
downloadcoreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.gz
coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.bz2
coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.zip
Imported Upstream version 1.1.0upstream/1.1.0
Diffstat (limited to 'tests/src/baseservices')
-rw-r--r--tests/src/baseservices/compilerservices/dynamicobjectproperties/Dev10_535767.csproj47
-rw-r--r--tests/src/baseservices/compilerservices/dynamicobjectproperties/TestAPIs.csproj48
-rw-r--r--tests/src/baseservices/compilerservices/dynamicobjectproperties/TestGC.csproj48
-rw-r--r--tests/src/baseservices/compilerservices/dynamicobjectproperties/TestOverrides.csproj48
-rw-r--r--tests/src/baseservices/compilerservices/dynamicobjectproperties/dev10_535767.cs434
-rw-r--r--tests/src/baseservices/compilerservices/dynamicobjectproperties/helper.cs60
-rw-r--r--tests/src/baseservices/compilerservices/dynamicobjectproperties/test448035.cs45
-rw-r--r--tests/src/baseservices/compilerservices/dynamicobjectproperties/test448035.csproj47
-rw-r--r--tests/src/baseservices/compilerservices/dynamicobjectproperties/testapis.cs583
-rw-r--r--tests/src/baseservices/compilerservices/dynamicobjectproperties/testgc.cs279
-rw-r--r--tests/src/baseservices/compilerservices/dynamicobjectproperties/testoverrides.cs93
-rw-r--r--tests/src/baseservices/exceptions/AccessViolationException/AVException01.cs35
-rw-r--r--tests/src/baseservices/exceptions/AccessViolationException/AVException01.csproj44
-rw-r--r--tests/src/baseservices/exceptions/AccessViolationException/AVException02.cs36
-rw-r--r--tests/src/baseservices/exceptions/AccessViolationException/AVException02.csproj44
-rw-r--r--tests/src/baseservices/exceptions/AccessViolationException/AVException03.cs35
-rw-r--r--tests/src/baseservices/exceptions/AccessViolationException/AVException03.csproj44
-rw-r--r--tests/src/baseservices/exceptions/StackTracePreserve/StackTracePreserveTests.cs530
-rw-r--r--tests/src/baseservices/exceptions/StackTracePreserve/StackTracePreserveTests.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/GenericExceptions.cs334
-rw-r--r--tests/src/baseservices/exceptions/generics/GenericExceptions.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/GenericExceptions01.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/GenericExceptions02.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/GenericExceptions03.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/GenericExceptions04.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/GenericExceptions05.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/GenericExceptions06.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/GenericExceptions07.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/GenericExceptions08.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter001.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter002.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter003.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter004.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter005.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter006.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter007.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter008.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter009.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter010.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter011.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter012.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter013.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter014.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter015.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter016.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter017.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/TypeParameter018.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/genericexceptions01.cs75
-rw-r--r--tests/src/baseservices/exceptions/generics/genericexceptions02.cs73
-rw-r--r--tests/src/baseservices/exceptions/generics/genericexceptions03.cs84
-rw-r--r--tests/src/baseservices/exceptions/generics/genericexceptions04.cs73
-rw-r--r--tests/src/baseservices/exceptions/generics/genericexceptions05.cs74
-rw-r--r--tests/src/baseservices/exceptions/generics/genericexceptions06.cs74
-rw-r--r--tests/src/baseservices/exceptions/generics/genericexceptions07.cs73
-rw-r--r--tests/src/baseservices/exceptions/generics/genericexceptions08.cs73
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch01.cs153
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch01.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch02.cs144
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch02.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch03.cs159
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch03.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch04.cs150
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch04.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch05.cs164
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch05.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch06.cs164
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch06.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch07.cs156
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch07.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch08.cs156
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch08.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch09.cs159
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch09.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch10.cs160
-rw-r--r--tests/src/baseservices/exceptions/generics/nested-try-catch10.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-finally-struct01.cs152
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-finally-struct01.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-finally-struct02.cs147
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-finally-struct02.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-finally-struct03.cs148
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-finally-struct03.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-finally01.cs152
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-finally01.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-finally02.cs147
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-finally02.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-finally03.cs148
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-finally03.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct01.cs145
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct01.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct02.cs141
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct02.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct03.cs155
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct03.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct04.cs145
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct04.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct05.cs142
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct05.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct06.cs145
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct06.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct07.cs142
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct07.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct08.cs145
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct08.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct09.cs141
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch-struct09.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch01.cs145
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch01.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch02.cs141
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch02.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch03.cs155
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch03.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch04.cs145
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch04.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch05.cs142
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch05.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch06.cs145
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch06.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch07.cs142
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch07.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch08.cs145
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch08.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch09.cs141
-rw-r--r--tests/src/baseservices/exceptions/generics/try-catch09.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-fault-struct01.il776
-rw-r--r--tests/src/baseservices/exceptions/generics/try-fault-struct01.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/generics/try-fault-struct02.il779
-rw-r--r--tests/src/baseservices/exceptions/generics/try-fault-struct02.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/generics/try-fault-struct03.il780
-rw-r--r--tests/src/baseservices/exceptions/generics/try-fault-struct03.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/generics/try-fault01.il540
-rw-r--r--tests/src/baseservices/exceptions/generics/try-fault01.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/generics/try-fault02.il540
-rw-r--r--tests/src/baseservices/exceptions/generics/try-fault02.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/generics/try-fault03.il541
-rw-r--r--tests/src/baseservices/exceptions/generics/try-fault03.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/generics/try-filter-finally01.il560
-rw-r--r--tests/src/baseservices/exceptions/generics/try-filter-finally01.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/generics/try-filter-finally02.il570
-rw-r--r--tests/src/baseservices/exceptions/generics/try-filter-finally02.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/generics/try-filter-struct02.il789
-rw-r--r--tests/src/baseservices/exceptions/generics/try-filter-struct02.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/generics/try-filter02.il554
-rw-r--r--tests/src/baseservices/exceptions/generics/try-filter02.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/generics/try-finally-struct01.cs153
-rw-r--r--tests/src/baseservices/exceptions/generics/try-finally-struct01.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-finally-struct02.cs152
-rw-r--r--tests/src/baseservices/exceptions/generics/try-finally-struct02.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-finally-struct03.cs154
-rw-r--r--tests/src/baseservices/exceptions/generics/try-finally-struct03.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-finally01.cs153
-rw-r--r--tests/src/baseservices/exceptions/generics/try-finally01.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-finally02.cs152
-rw-r--r--tests/src/baseservices/exceptions/generics/try-finally02.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/try-finally03.cs154
-rw-r--r--tests/src/baseservices/exceptions/generics/try-finally03.csproj44
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter001.cs101
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter002.cs101
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter003.cs102
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter004.cs101
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter005.cs101
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter006.cs101
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter007.cs101
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter008.cs101
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter009.cs75
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter010.cs75
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter011.cs75
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter012.cs75
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter013.cs75
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter014.cs75
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter015.cs75
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter016.cs75
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter017.cs79
-rw-r--r--tests/src/baseservices/exceptions/generics/typeparameter018.cs79
-rw-r--r--tests/src/baseservices/exceptions/regressions/Dev11/147911/CMakeLists.txt11
-rw-r--r--tests/src/baseservices/exceptions/regressions/Dev11/147911/fpcw.cpp206
-rw-r--r--tests/src/baseservices/exceptions/regressions/Dev11/147911/fpcw.h19
-rw-r--r--tests/src/baseservices/exceptions/regressions/Dev11/147911/test147911.cs20
-rw-r--r--tests/src/baseservices/exceptions/regressions/Dev11/147911/test147911.csproj47
-rw-r--r--tests/src/baseservices/exceptions/regressions/Dev11/154243/dynamicmethodliveness.cs99
-rw-r--r--tests/src/baseservices/exceptions/regressions/Dev11/154243/dynamicmethodliveness.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/finally.cs40
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/finally.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/rethrow.cs147
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/rethrow.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/CMakeLists.txt11
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/ExternalException.cs86
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/ExternalException.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/HandlerException.cs123
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/HandlerException.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/MultipleException.cs61
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/MultipleException.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx1.cs126
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx1.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx2.cs178
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx2.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedException.cs114
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedException.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NormalException.cs202
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NormalException.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/RecursiveException.cs50
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/RecursiveException.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatch.cs107
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatch.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatchFinally.cs31
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatchFinally.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/Unmanaged.cpp26
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/Unmanaged.h9
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UnmanagedToManaged.cs34
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UnmanagedToManaged.csproj47
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserException.cs42
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserException.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserExceptionThread.cs59
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserExceptionThread.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Except.il99
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Except.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltCatch.il109
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltCatch.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltFallThru.il170
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltFallThru.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Filter.il102
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Filter.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Finally.il127
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Finally.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedExcept.il108
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedExcept.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedFilt.il151
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedFilt.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/coverage/Exceptions.cs467
-rw-r--r--tests/src/baseservices/exceptions/regressions/V1/SEH/coverage/Exceptions.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/v1.0/15266.il73
-rw-r--r--tests/src/baseservices/exceptions/regressions/v1.0/15266.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/regressions/v1.0/19896.cs34
-rw-r--r--tests/src/baseservices/exceptions/regressions/v1.0/19896.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/v4.0/640474/other.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/v4.0/640474/other1.cs9
-rw-r--r--tests/src/baseservices/exceptions/regressions/v4.0/640474/test640474.cs63
-rw-r--r--tests/src/baseservices/exceptions/regressions/v4.0/640474/test640474.csproj45
-rw-r--r--tests/src/baseservices/exceptions/regressions/v4.0/706099/ManagedCom.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/v4.0/706099/managedcom.cs62
-rw-r--r--tests/src/baseservices/exceptions/regressions/whidbeyM3.2/151232.cs47
-rw-r--r--tests/src/baseservices/exceptions/regressions/whidbeyM3.2/151232.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/whidbeybeta2/349379/349379.cs95
-rw-r--r--tests/src/baseservices/exceptions/regressions/whidbeybeta2/349379/349379.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/whidbeybeta2/366085/366085.cs41
-rw-r--r--tests/src/baseservices/exceptions/regressions/whidbeybeta2/366085/366085.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/whidbeym3.3/106011/106011.cs68
-rw-r--r--tests/src/baseservices/exceptions/regressions/whidbeym3.3/106011/106011.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/whidbeym3.3/293674/ReproTrusted.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/whidbeym3.3/293674/securedispatcher.cs45
-rw-r--r--tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/302680.cs23
-rw-r--r--tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/302680.csproj44
-rw-r--r--tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/data.cs16
-rw-r--r--tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/data.csproj44
-rw-r--r--tests/src/baseservices/exceptions/sharedexceptions/emptystacktrace/OOMException01.csproj45
-rw-r--r--tests/src/baseservices/exceptions/sharedexceptions/emptystacktrace/oomexception01.cs62
-rw-r--r--tests/src/baseservices/exceptions/simple/ArrayInit.cs72
-rw-r--r--tests/src/baseservices/exceptions/simple/ArrayInit.csproj45
-rw-r--r--tests/src/baseservices/exceptions/simple/HardwareEh.cs331
-rw-r--r--tests/src/baseservices/exceptions/simple/HardwareEh.csproj45
-rw-r--r--tests/src/baseservices/exceptions/simple/ILHelper.cs23
-rw-r--r--tests/src/baseservices/exceptions/simple/ILHelper.il57
-rw-r--r--tests/src/baseservices/exceptions/simple/ILHelper.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/simple/VT.il67
-rw-r--r--tests/src/baseservices/exceptions/simple/VT.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/simple/fault.il92
-rw-r--r--tests/src/baseservices/exceptions/simple/fault.ilproj42
-rw-r--r--tests/src/baseservices/exceptions/simple/finally.cs188
-rw-r--r--tests/src/baseservices/exceptions/simple/finally.csproj44
-rw-r--r--tests/src/baseservices/exceptions/unittests/Baadbaad.cs95
-rw-r--r--tests/src/baseservices/exceptions/unittests/Baadbaad.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/BaseClass.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/CollidedUnwind.cs165
-rw-r--r--tests/src/baseservices/exceptions/unittests/CollidedUnwind.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/EHPatternTests.cs1434
-rw-r--r--tests/src/baseservices/exceptions/unittests/EHPatternTests.csproj44
-rw-r--r--tests/src/baseservices/exceptions/unittests/GoryManagedPresent.cs100
-rw-r--r--tests/src/baseservices/exceptions/unittests/GoryManagedPresent.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/GoryNativePast.cs91
-rw-r--r--tests/src/baseservices/exceptions/unittests/GoryNativePast.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/InnerFinally.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/InnerFinallyAndCatch.cs131
-rw-r--r--tests/src/baseservices/exceptions/unittests/InnerFinallyAndCatch.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/Pending.cs111
-rw-r--r--tests/src/baseservices/exceptions/unittests/Pending.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/Recurse.cs82
-rw-r--r--tests/src/baseservices/exceptions/unittests/Recurse.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/RecursiveRethrow.cs91
-rw-r--r--tests/src/baseservices/exceptions/unittests/RecursiveRethrow.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/RecursiveThrowNew.cs92
-rw-r--r--tests/src/baseservices/exceptions/unittests/RecursiveThrowNew.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/RethrowAndFinally.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/ReturnFromCatch.csproj44
-rw-r--r--tests/src/baseservices/exceptions/unittests/StrSwitchFinally.cs326
-rw-r--r--tests/src/baseservices/exceptions/unittests/StrSwitchFinally.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/ThrowInCatch.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/ThrowInFinally.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/ThrowInFinallyNestedInTry.cs101
-rw-r--r--tests/src/baseservices/exceptions/unittests/ThrowInFinallyNestedInTry.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/TryCatchInFinally.csproj45
-rw-r--r--tests/src/baseservices/exceptions/unittests/baseclass.cs99
-rw-r--r--tests/src/baseservices/exceptions/unittests/innerfinally.cs102
-rw-r--r--tests/src/baseservices/exceptions/unittests/rethrowandfinally.cs125
-rw-r--r--tests/src/baseservices/exceptions/unittests/returnfromcatch.cs57
-rw-r--r--tests/src/baseservices/exceptions/unittests/throwincatch.cs79
-rw-r--r--tests/src/baseservices/exceptions/unittests/throwinfinally.cs101
-rw-r--r--tests/src/baseservices/exceptions/unittests/trace.cs55
-rw-r--r--tests/src/baseservices/exceptions/unittests/trycatchinfinally.cs77
-rw-r--r--tests/src/baseservices/finalization/Finalizer.csproj44
-rw-r--r--tests/src/baseservices/finalization/FinalizerSigned.csproj44
-rw-r--r--tests/src/baseservices/finalization/finalizer.cs193
-rw-r--r--tests/src/baseservices/ilasm_ildasm/regression/dd130885/xlib.cs24
-rw-r--r--tests/src/baseservices/ilasm_ildasm/regression/dd130885/xlib.csproj47
-rw-r--r--tests/src/baseservices/ilasm_ildasm/regression/vswhidbey267905/267905.cs14
-rw-r--r--tests/src/baseservices/ilasm_ildasm/regression/vswhidbey267905/267905.csproj44
-rw-r--r--tests/src/baseservices/ilasm_ildasm/regression/vswhidbey305155/305155.cs16
-rw-r--r--tests/src/baseservices/ilasm_ildasm/regression/vswhidbey305155/305155.csproj44
-rw-r--r--tests/src/baseservices/ilasm_ildasm/regression/vswhidbey395914/395914.cs9
-rw-r--r--tests/src/baseservices/ilasm_ildasm/regression/vswhidbey395914/395914.csproj47
-rw-r--r--tests/src/baseservices/multidimmarray/enum.cs26
-rw-r--r--tests/src/baseservices/multidimmarray/enum.csproj44
-rw-r--r--tests/src/baseservices/regression/v1/assembly/vos/cool/helloworld/First.csproj44
-rw-r--r--tests/src/baseservices/regression/v1/assembly/vos/cool/helloworld/first.cool31
-rw-r--r--tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/Assembly1.csproj44
-rw-r--r--tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/assembly1.cool70
-rw-r--r--tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/assembly2.cool154
-rw-r--r--tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/assembly3.cool23
-rw-r--r--tests/src/baseservices/regression/v1/seh/vc/chain/ManagedDll.csproj44
-rw-r--r--tests/src/baseservices/regression/v1/seh/vc/chain/manageddll.cool7
-rw-r--r--tests/src/baseservices/regression/v1/threads/functional/thread/TcultureDLL.csproj44
-rw-r--r--tests/src/baseservices/regression/v1/threads/functional/thread/tculturedll.cs246
-rw-r--r--tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_support/ThreadPool_Test.csproj45
-rw-r--r--tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_support/fibonacci.cs71
-rw-r--r--tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_support/foo.cs20
-rw-r--r--tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_threadpoolnullchecks/CS_ThreadPoolNullChecks.csproj45
-rw-r--r--tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_threadpoolnullchecks/cs_threadpoolnullchecks.cs49
-rw-r--r--tests/src/baseservices/regression/v1/threads/hostedscenario/apunload/MgdHelper.csproj44
-rw-r--r--tests/src/baseservices/regression/v1/threads/hostedscenario/apunload/mgdhelper.cs55
-rw-r--r--tests/src/baseservices/regression/v1/threads/hostedscenario/apunloadtwo/interoptest.csproj44
-rw-r--r--tests/src/baseservices/regression/v1/threads/hostedscenario/apunloadtwo/sample.cs95
-rw-r--r--tests/src/baseservices/threading/commitstackonlyasneeded/DefaultStackCommit.cs29
-rw-r--r--tests/src/baseservices/threading/commitstackonlyasneeded/DefaultStackCommit.csproj42
-rw-r--r--tests/src/baseservices/threading/commitstackonlyasneeded/DisablePreCommit.exe.config9
-rw-r--r--tests/src/baseservices/threading/commitstackonlyasneeded/EnablePreCommit.exe.config9
-rw-r--r--tests/src/baseservices/threading/commitstackonlyasneeded/StackCommitCommon.cs244
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_ARENullRefEx.cs150
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_ARENullRefEx.csproj41
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_MRENullRefEx.cs150
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_MRENullRefEx.csproj41
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_MutexNullRefEx.cs142
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_MutexNullRefEx.csproj41
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.cs76
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.csproj41
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_SLENullRefEx.cs125
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_SLENullRefEx.csproj41
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_TSNullRefEx.cs124
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_TSNullRefEx.csproj41
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_TimerNullRefEx.cs114
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_TimerNullRefEx.csproj41
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_WHNullRefEx.cs134
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_WHNullRefEx.csproj41
-rw-r--r--tests/src/baseservices/threading/currentculture/CultureChangeSecurity.csproj45
-rw-r--r--tests/src/baseservices/threading/currentculture/culturechangesecurity.cs62
-rw-r--r--tests/src/baseservices/threading/delegate/BeginInvokeEndInvoke.cs58
-rw-r--r--tests/src/baseservices/threading/delegate/BeginInvokeEndInvoke.csproj40
-rw-r--r--tests/src/baseservices/threading/events/AutoResetEvent/ConstructFalse.cs68
-rw-r--r--tests/src/baseservices/threading/events/AutoResetEvent/ConstructFalse.csproj41
-rw-r--r--tests/src/baseservices/threading/events/AutoResetEvent/ConstructTrue.cs50
-rw-r--r--tests/src/baseservices/threading/events/AutoResetEvent/ConstructTrue.csproj41
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast1.cs45
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast1.csproj44
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast2.cs50
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast2.csproj44
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor1.cs45
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor1.csproj44
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor2.cs50
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor2.csproj44
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast1.cs47
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast1.csproj44
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast2.cs48
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast2.csproj44
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor1.cs47
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor1.csproj44
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor2.cs48
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor2.csproj44
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/NamedCommon.cs35
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructFalse.cs35
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructFalse.csproj42
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructTrue.cs28
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructTrue.csproj42
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/unit/EventWaitHandleTest.cs60
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructFalse.cs36
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructFalse.csproj42
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructTrue.cs34
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructTrue.csproj42
-rw-r--r--tests/src/baseservices/threading/events/ManualResetEvent/ConstructFalse.cs58
-rw-r--r--tests/src/baseservices/threading/events/ManualResetEvent/ConstructFalse.csproj41
-rw-r--r--tests/src/baseservices/threading/events/ManualResetEvent/ConstructTrue.cs36
-rw-r--r--tests/src/baseservices/threading/events/ManualResetEvent/ConstructTrue.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit01.cs94
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit01.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit02.cs167
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit02.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit03.cs99
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit03.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit04.cs172
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit04.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit05.cs99
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit05.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit06.cs171
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit06.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit07.cs98
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit07.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit08.cs171
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit08.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit09.cs97
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit09.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit10.cs113
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit10.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit11.cs102
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit11.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit12.cs179
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit12.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit13.cs101
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit13.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit14.cs178
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit14.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/MonitorHelper.cs89
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter01.cs98
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter01.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter03.cs177
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter03.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter04.cs99
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter04.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter05.cs99
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter05.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter06.cs177
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter06.csproj42
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread01.cs84
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread01.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread02.cs84
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread02.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread03.cs80
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread03.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread04.cs80
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread04.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread05.cs80
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread05.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread06.cs80
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread06.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread07.cs84
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread07.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread08.cs80
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread08.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread09.cs80
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread09.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread10.cs93
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread10.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread11.cs93
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread11.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread12.cs93
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread12.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread13.cs219
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread13.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread14.cs219
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread14.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread15.cs219
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread15.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread16.cs85
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread16.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread17.cs85
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread17.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread18.cs85
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread18.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread19.cs89
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread19.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread20.cs89
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread20.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread21.cs89
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread21.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread22.cs243
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread22.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread23.cs243
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread23.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread24.cs243
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread24.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread25.cs82
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread25.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread26.cs82
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread26.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread27.cs78
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread27.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread28.cs78
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread28.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread29.cs78
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread29.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread30.cs78
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread30.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/tighttimercallback.cs91
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/tighttimercallback.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread01.cs84
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread01.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread02.cs84
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread02.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread03.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread03.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread04.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread04.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread05.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread05.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread06.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread06.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread07.cs84
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread07.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread08.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread08.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread09.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread09.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread10.cs94
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread10.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread11.cs94
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread11.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread12.cs94
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread12.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread13.cs236
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread13.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread14.cs236
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread14.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread15.cs236
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread15.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread16.cs85
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread16.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread17.cs85
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread17.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread18.cs85
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread18.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread19.cs89
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread19.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread20.cs89
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread20.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread21.cs89
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread21.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread22.cs271
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread22.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread23.cs269
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread23.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread24.cs267
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread24.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread25.cs84
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread25.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread26.cs86
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread26.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread27.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread27.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread28.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread28.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread29.cs78
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread29.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread30.cs78
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread30.csproj41
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread01.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread02.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread03.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread04.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread05.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread06.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread07.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread08.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread09.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread10.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread11.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread12.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread13.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread14.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread15.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread16.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread17.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread18.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread19.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread20.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread21.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread22.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread23.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread24.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread25.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread26.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread27.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread28.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread29.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/GThread30.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread01.cs66
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread02.cs66
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread03.cs62
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread04.cs64
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread05.cs64
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread06.cs64
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread07.cs68
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread08.cs64
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread09.cs64
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread10.cs79
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread11.cs79
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread12.cs79
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread13.cs156
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread14.cs156
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread15.cs156
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread16.cs70
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread17.cs70
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread18.cs70
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread19.cs74
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread20.cs74
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread21.cs74
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread22.cs193
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread23.cs193
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread24.cs193
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread25.cs68
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread26.cs68
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread27.cs65
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread28.cs65
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread29.cs64
-rw-r--r--tests/src/baseservices/threading/generics/syncdelegate/thread30.cs64
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread01.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread02.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread03.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread04.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread05.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread06.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread07.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread08.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread09.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread10.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread11.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread12.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread13.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread14.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread15.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread16.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread17.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread18.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread19.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread20.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread21.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread22.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread23.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread24.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread25.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread26.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread27.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread28.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread29.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/GThread30.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread01.cs78
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread02.cs78
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread03.cs74
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread04.cs74
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread05.cs74
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread06.cs74
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread07.cs78
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread08.cs74
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread09.cs74
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread10.cs88
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread11.cs88
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread12.cs88
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread13.cs201
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread14.cs201
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread15.cs201
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread16.cs79
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread17.cs79
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread18.cs79
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread19.cs83
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread20.cs83
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread21.cs83
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread22.cs238
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread23.cs238
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread24.cs238
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread25.cs77
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread26.cs77
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread27.cs74
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread28.cs74
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread29.cs73
-rw-r--r--tests/src/baseservices/threading/generics/threadstart/thread30.cs73
-rw-r--r--tests/src/baseservices/threading/interlocked/add/CheckAddInt.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/add/CheckAddInt_1.csproj40
-rw-r--r--tests/src/baseservices/threading/interlocked/add/CheckAddLong.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/add/CheckAddLong_1.csproj40
-rw-r--r--tests/src/baseservices/threading/interlocked/add/InterlockedAddInt.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/add/InterlockedAddInt_1.csproj40
-rw-r--r--tests/src/baseservices/threading/interlocked/add/InterlockedAddInt_2.csproj40
-rw-r--r--tests/src/baseservices/threading/interlocked/add/InterlockedAddInt_3.csproj40
-rw-r--r--tests/src/baseservices/threading/interlocked/add/InterlockedAddLong.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/add/InterlockedAddLongWithSubtract.csproj45
-rw-r--r--tests/src/baseservices/threading/interlocked/add/InterlockedAddLong_1.csproj40
-rw-r--r--tests/src/baseservices/threading/interlocked/add/InterlockedAddLong_2.csproj40
-rw-r--r--tests/src/baseservices/threading/interlocked/add/add.cs41
-rw-r--r--tests/src/baseservices/threading/interlocked/add/add.csproj38
-rw-r--r--tests/src/baseservices/threading/interlocked/add/checkaddint.cs64
-rw-r--r--tests/src/baseservices/threading/interlocked/add/checkaddlong.cs64
-rw-r--r--tests/src/baseservices/threading/interlocked/add/interlockedaddint.cs101
-rw-r--r--tests/src/baseservices/threading/interlocked/add/interlockedaddintwithsubtract.cs107
-rw-r--r--tests/src/baseservices/threading/interlocked/add/interlockedaddintwithsubtract.csproj39
-rw-r--r--tests/src/baseservices/threading/interlocked/add/interlockedaddlong.cs101
-rw-r--r--tests/src/baseservices/threading/interlocked/add/interlockedaddlongwithsubtract.cs106
-rw-r--r--tests/src/baseservices/threading/interlocked/checkreturn/intdeccheckreturn.cs23
-rw-r--r--tests/src/baseservices/threading/interlocked/checkreturn/intdeccheckreturn.csproj39
-rw-r--r--tests/src/baseservices/threading/interlocked/checkreturn/intinccheckreturn.cs23
-rw-r--r--tests/src/baseservices/threading/interlocked/checkreturn/intinccheckreturn.csproj39
-rw-r--r--tests/src/baseservices/threading/interlocked/checkreturn/longdeccheckreturn.cs22
-rw-r--r--tests/src/baseservices/threading/interlocked/checkreturn/longdeccheckreturn.csproj39
-rw-r--r--tests/src/baseservices/threading/interlocked/checkreturn/longinccheckreturn.cs22
-rw-r--r--tests/src/baseservices/threading/interlocked/checkreturn/longinccheckreturn.csproj39
-rw-r--r--tests/src/baseservices/threading/interlocked/common/interlockedhelper_coreclr.cs282
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong_1.csproj40
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong_2.csproj40
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong_3.csproj40
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeTClass.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeTClass_1.csproj40
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeTString.csproj45
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchange1_cti.cs148
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchange1_cti.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchange2.cs361
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchange2.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchange3.cs167
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchange3.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchange4.cs168
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchange4.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchange5_cti.cs252
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchange5_cti.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchangedouble.cs120
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchangedouble.csproj39
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchangefloat.cs98
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchangefloat.csproj39
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeint.cs91
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeint.csproj39
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeintptr.cs87
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeintptr.csproj39
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchangelong.cs116
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeobject.cs101
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeobject.csproj39
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchanget.cs57
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchanget.csproj38
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchangetclass.cs145
-rw-r--r--tests/src/baseservices/threading/interlocked/compareexchange/compareexchangetstring.cs104
-rw-r--r--tests/src/baseservices/threading/interlocked/ctorchk/ctorchk.cs30
-rw-r--r--tests/src/baseservices/threading/interlocked/ctorchk/ctorchk.csproj38
-rw-r--r--tests/src/baseservices/threading/interlocked/decrement/intdec.cs32
-rw-r--r--tests/src/baseservices/threading/interlocked/decrement/intdec.csproj39
-rw-r--r--tests/src/baseservices/threading/interlocked/decrement/longdec.cs31
-rw-r--r--tests/src/baseservices/threading/interlocked/decrement/longdec.csproj39
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/ExchangeInt.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/ExchangeLong.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/ExchangeTClass.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/ExchangeTString.csproj43
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/ExchangeTString_1.csproj40
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/ExchangeTString_2.csproj40
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchange1_cti.cs165
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchange1_cti.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchange2.cs150
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchange2.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchange3.cs86
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchange3.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchange4.cs86
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchange4.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchange4_cti.cs165
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchange4_cti.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchange5_cti.cs165
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchange5_cti.csproj44
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchangedouble.cs99
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchangedouble.csproj38
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchangefloat.cs107
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchangefloat.csproj38
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchangeint.cs103
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchangelong.cs100
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchangeobject.cs107
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchangeobject.csproj38
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchanget.cs42
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchanget.csproj38
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchangetclass.cs145
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchangetneg.il115
-rw-r--r--tests/src/baseservices/threading/interlocked/exchange/exchangetstring.cs177
-rw-r--r--tests/src/baseservices/threading/interlocked/increment/intinc.cs31
-rw-r--r--tests/src/baseservices/threading/interlocked/increment/intinc.csproj39
-rw-r--r--tests/src/baseservices/threading/interlocked/increment/longinc.cs31
-rw-r--r--tests/src/baseservices/threading/interlocked/increment/longinc.csproj39
-rw-r--r--tests/src/baseservices/threading/interlocked/read/interlockedread.cs41
-rw-r--r--tests/src/baseservices/threading/interlocked/read/interlockedread.csproj38
-rw-r--r--tests/src/baseservices/threading/interlocked/read/readthreads.cs97
-rw-r--r--tests/src/baseservices/threading/interlocked/read/readthreads.csproj38
-rw-r--r--tests/src/baseservices/threading/monitor/ctorchk/ctorchk.cs30
-rw-r--r--tests/src/baseservices/threading/monitor/ctorchk/ctorchk.csproj38
-rw-r--r--tests/src/baseservices/threading/monitor/enter/EnterNull.csproj44
-rw-r--r--tests/src/baseservices/threading/monitor/enter/enternull.cs25
-rw-r--r--tests/src/baseservices/threading/monitor/enter/monitorenter.cs501
-rw-r--r--tests/src/baseservices/threading/monitor/enter/monitorenter.csproj38
-rw-r--r--tests/src/baseservices/threading/monitor/exit/ExitNull.csproj44
-rw-r--r--tests/src/baseservices/threading/monitor/exit/exitnull.cs25
-rw-r--r--tests/src/baseservices/threading/monitor/isentered/monitorisentered.cs128
-rw-r--r--tests/src/baseservices/threading/monitor/isentered/monitorisentered.csproj38
-rw-r--r--tests/src/baseservices/threading/monitor/pulse/PulseNull.csproj44
-rw-r--r--tests/src/baseservices/threading/monitor/pulse/pulsenull.cs25
-rw-r--r--tests/src/baseservices/threading/monitor/pulseall/PulseAllNull.csproj44
-rw-r--r--tests/src/baseservices/threading/monitor/pulseall/pulseallnull.cs26
-rw-r--r--tests/src/baseservices/threading/monitor/tryenter/longtimeout.cs92
-rw-r--r--tests/src/baseservices/threading/monitor/tryenter/longtimeout.csproj38
-rw-r--r--tests/src/baseservices/threading/monitor/unownedlock/EnterExitExit.csproj44
-rw-r--r--tests/src/baseservices/threading/monitor/unownedlock/NoEnterNewObject.csproj44
-rw-r--r--tests/src/baseservices/threading/monitor/unownedlock/NoEnterObject.csproj44
-rw-r--r--tests/src/baseservices/threading/monitor/unownedlock/NoEnterValType.csproj44
-rw-r--r--tests/src/baseservices/threading/monitor/unownedlock/enterexitexit.cs34
-rw-r--r--tests/src/baseservices/threading/monitor/unownedlock/noenterobject.cs25
-rw-r--r--tests/src/baseservices/threading/monitor/unownedlock/noenterobjectnew.cs24
-rw-r--r--tests/src/baseservices/threading/monitor/unownedlock/noentervaltype.cs25
-rw-r--r--tests/src/baseservices/threading/monitor/wait/waitnull.cs26
-rw-r--r--tests/src/baseservices/threading/monitor/wait/waitnull.csproj38
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am01waitallneg.cs52
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am01waitallneg.csproj38
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am02waitoneneg.cs59
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am02waitoneneg.csproj38
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am04waitany.cs113
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am04waitany.csproj40
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am05waitanymutex.cs112
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am05waitanymutex.csproj40
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am06abandonall.cs70
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am06abandonall.csproj39
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am07abandonmultiplemutex.cs96
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am07abandonmultiplemutex.csproj39
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am08mixedarray.cs119
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am08mixedarray.csproj39
-rw-r--r--tests/src/baseservices/threading/mutex/misc/mutexctor1.cs173
-rw-r--r--tests/src/baseservices/threading/mutex/misc/mutexctor1.csproj44
-rw-r--r--tests/src/baseservices/threading/mutex/misc/mutexctor2.cs104
-rw-r--r--tests/src/baseservices/threading/mutex/misc/mutexctor2.csproj44
-rw-r--r--tests/src/baseservices/threading/mutex/misc/waitone1.cs217
-rw-r--r--tests/src/baseservices/threading/mutex/misc/waitone1.csproj44
-rw-r--r--tests/src/baseservices/threading/mutex/misc/waitone2.cs573
-rw-r--r--tests/src/baseservices/threading/mutex/misc/waitone2.csproj44
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg1.cs38
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg1.csproj39
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg2.cs38
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg2.csproj38
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg3.cs38
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg3.csproj38
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg4.cs39
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg4.csproj38
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg5.cs40
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg5.csproj39
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg6.cs42
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg6.csproj39
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg7.cs59
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg7.csproj39
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.cs41
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.csproj38
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexpos1.cs59
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexpos1.csproj39
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexpos2.cs46
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexpos2.csproj39
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexpos3.cs48
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexpos3.csproj39
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexpos4.cs86
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexpos4.csproj38
-rw-r--r--tests/src/baseservices/threading/mutex/openmutexcommon.cs32
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartBool.csproj43
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartBool_1.csproj39
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartByte.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartByte_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartByte_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartCast.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartCast_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartCast_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartChar.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartChar_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartChar_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartChar_3.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartDecimal.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartDecimal_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartDecimal_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartDelegate.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartDelegate_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartDelegate_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartDouble.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartDouble_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartDouble_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartFloat.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartFloat_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartFloat_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartGenerics.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartGenerics_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartGenerics_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartInt.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartInt_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartInt_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartLong.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartLong_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartLong_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartNeg1.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartNeg3.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartNeg4.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartNull.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartNull2.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartObject.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartObject_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartObject_2.csproj39
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartOperations.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartOperations_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartOperations_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartSByte.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartSByte_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartSByte_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartShort.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartShort_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartShort_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartString.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartString_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartString_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartString_3.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartUInt.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartUInt_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartUInt_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartULong.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartULong_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartULong_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartUShort.csproj44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartUShort_1.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/ThreadStartUShort_2.csproj40
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartarray.cs58
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartarray.csproj38
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartbool.cs38
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartbyte.cs47
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartcast.cs48
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartchar.cs49
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartclass.cs52
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartclass.csproj38
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartdecimal.cs46
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartdelegate.cs60
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartdouble.cs71
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartfloat.cs46
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartgenerics.cs57
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartint.cs47
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartlong.cs47
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartneg1.cs43
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartneg3.cs45
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartneg4.cs36
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartnull.cs33
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartnull2.cs34
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartobject.cs38
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartoperations.cs81
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartsbyte.cs47
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartshort.cs47
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartstring.cs44
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartstruct.cs67
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartstruct.csproj38
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartuint.cs47
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartulong.cs47
-rw-r--r--tests/src/baseservices/threading/paramthreadstart/threadstartushort.cs47
-rw-r--r--tests/src/baseservices/threading/regressions/13662/13662-a.cs33
-rw-r--r--tests/src/baseservices/threading/regressions/13662/13662-a.csproj38
-rw-r--r--tests/src/baseservices/threading/regressions/13662/13662-b.cs89
-rw-r--r--tests/src/baseservices/threading/regressions/13662/13662-b.csproj38
-rw-r--r--tests/src/baseservices/threading/regressions/13662/13662-simple.csproj38
-rw-r--r--tests/src/baseservices/threading/regressions/13662/simple.cs33
-rw-r--r--tests/src/baseservices/threading/regressions/17360/AVHelper.csproj45
-rw-r--r--tests/src/baseservices/threading/regressions/17360/avhelper.cs40
-rw-r--r--tests/src/baseservices/threading/regressions/269336/objmonhelper.cs37
-rw-r--r--tests/src/baseservices/threading/regressions/269336/objmonhelper.csproj38
-rw-r--r--tests/src/baseservices/threading/regressions/30032/30032.cs40
-rw-r--r--tests/src/baseservices/threading/regressions/30032/30032.csproj38
-rw-r--r--tests/src/baseservices/threading/regressions/576463/576463.cs172
-rw-r--r--tests/src/baseservices/threading/regressions/576463/576463.csproj45
-rw-r--r--tests/src/baseservices/threading/regressions/6906/6906.csproj44
-rw-r--r--tests/src/baseservices/threading/regressions/6906/repro.cs41
-rw-r--r--tests/src/baseservices/threading/regressions/beta1/347011.cs35
-rw-r--r--tests/src/baseservices/threading/regressions/beta1/347011.csproj39
-rw-r--r--tests/src/baseservices/threading/regressions/beta2/437017.cs125
-rw-r--r--tests/src/baseservices/threading/regressions/beta2/437017.csproj38
-rw-r--r--tests/src/baseservices/threading/regressions/beta2/437044.cs119
-rw-r--r--tests/src/baseservices/threading/regressions/beta2/437044.csproj38
-rw-r--r--tests/src/baseservices/threading/regressions/devdiv489437/test489437.cs52
-rw-r--r--tests/src/baseservices/threading/regressions/devdiv489437/test489437.csproj38
-rw-r--r--tests/src/baseservices/threading/regressions/threadex.cs20
-rw-r--r--tests/src/baseservices/threading/regressions/whidbey_m3/200176.cs33
-rw-r--r--tests/src/baseservices/threading/regressions/whidbey_m3/200176.csproj38
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorector1.cs69
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorector1.csproj39
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorector2.cs99
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorector2.csproj40
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorector3.cs128
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorector3.csproj39
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorector4.cs97
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorector4.csproj40
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorector5.cs108
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorector5.csproj40
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg1.cs65
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg1.csproj39
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg2.cs93
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg2.csproj40
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg3.cs103
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg3.csproj39
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg1.cs38
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg1.csproj39
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg2.cs40
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg2.csproj38
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg3.cs38
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg3.csproj38
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg4.cs39
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg4.csproj38
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg5.cs42
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg5.csproj39
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg6.cs42
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg6.csproj39
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg7.cs43
-rw-r--r--tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg7.csproj39
-rw-r--r--tests/src/baseservices/threading/semaphore/semaphorecommon.cs36
-rw-r--r--tests/src/baseservices/threading/semaphore/unit/semdemo.cs88
-rw-r--r--tests/src/baseservices/threading/semaphore/unit/semdemo.csproj38
-rw-r--r--tests/src/baseservices/threading/semaphore/unit/semtest.cs190
-rw-r--r--tests/src/baseservices/threading/semaphore/unit/semtest.csproj38
-rw-r--r--tests/src/baseservices/threading/stress/sudoku/Stack.csproj44
-rw-r--r--tests/src/baseservices/threading/stress/sudoku/SudokuInterfaces.csproj46
-rw-r--r--tests/src/baseservices/threading/stress/sudoku/isudokuboard.cs25
-rw-r--r--tests/src/baseservices/threading/stress/sudoku/isudokugenerator.cs21
-rw-r--r--tests/src/baseservices/threading/stress/sudoku/isudokusolver.cs18
-rw-r--r--tests/src/baseservices/threading/stress/sudoku/stack.cs105
-rw-r--r--tests/src/baseservices/threading/threadpool/bindhandle/bindhandle1.cs63
-rw-r--r--tests/src/baseservices/threading/threadpool/bindhandle/bindhandle1.csproj38
-rw-r--r--tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid.cs41
-rw-r--r--tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid.csproj38
-rw-r--r--tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid3.cs62
-rw-r--r--tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid3.csproj38
-rw-r--r--tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid4.cs57
-rw-r--r--tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid4.csproj38
-rw-r--r--tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid5.cs63
-rw-r--r--tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid5.csproj38
-rw-r--r--tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid6.cs78
-rw-r--r--tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid6.csproj38
-rw-r--r--tests/src/baseservices/threading/threadpool/bindhandle/bindhandlenull.cs33
-rw-r--r--tests/src/baseservices/threading/threadpool/bindhandle/bindhandlenull.csproj38
-rw-r--r--tests/src/baseservices/threading/threadpool/ctorchk/ctorchk.cs30
-rw-r--r--tests/src/baseservices/threading/threadpool/ctorchk/ctorchk.csproj38
-rw-r--r--tests/src/baseservices/threading/threadpool/unregister/regression_749068.cs137
-rw-r--r--tests/src/baseservices/threading/threadpool/unregister/regression_749068.csproj38
-rw-r--r--tests/src/baseservices/threading/threadpool/unregister/unregister01.cs64
-rw-r--r--tests/src/baseservices/threading/threadpool/unregister/unregister01.csproj38
-rw-r--r--tests/src/baseservices/threading/threadpool/unregister/unregister03.cs65
-rw-r--r--tests/src/baseservices/threading/threadpool/unregister/unregister03.csproj38
-rw-r--r--tests/src/baseservices/threading/threadstatic/ThreadStatic01.csproj44
-rw-r--r--tests/src/baseservices/threading/threadstatic/ThreadStatic02.csproj44
-rw-r--r--tests/src/baseservices/threading/threadstatic/ThreadStatic03.csproj44
-rw-r--r--tests/src/baseservices/threading/threadstatic/ThreadStatic04Helper.csproj44
-rw-r--r--tests/src/baseservices/threading/threadstatic/ThreadStatic05.csproj44
-rw-r--r--tests/src/baseservices/threading/threadstatic/ThreadStatic06.csproj44
-rw-r--r--tests/src/baseservices/threading/threadstatic/threadstatic01.cs799
-rw-r--r--tests/src/baseservices/threading/threadstatic/threadstatic02.cs81
-rw-r--r--tests/src/baseservices/threading/threadstatic/threadstatic03.cs76
-rw-r--r--tests/src/baseservices/threading/threadstatic/threadstatic04helper.cs29
-rw-r--r--tests/src/baseservices/threading/threadstatic/threadstatic05.cs86
-rw-r--r--tests/src/baseservices/threading/threadstatic/threadstatic06.cs80
-rw-r--r--tests/src/baseservices/threading/threadstatic/threadstatic07.cs221
-rw-r--r--tests/src/baseservices/threading/threadstatic/threadstatic07.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/misc/waithandledispose2.cs100
-rw-r--r--tests/src/baseservices/threading/waithandle/misc/waithandledispose2.csproj44
-rw-r--r--tests/src/baseservices/threading/waithandle/misc/waithandlewaitone1.cs292
-rw-r--r--tests/src/baseservices/threading/waithandle/misc/waithandlewaitone1.csproj44
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/emptyarray.cs41
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/nullarray.cs52
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/nullarraymember.cs41
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/nullarraymember.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallemptyarray.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex1.cs60
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex1.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex10.cs103
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex10.csproj40
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex10a.cs103
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex10a.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex11.cs70
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex11.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex11a.cs70
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex11a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex1a.cs60
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex1a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex2.cs66
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex2.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex2a.cs66
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex2a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex3.cs97
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex3.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex3a.cs97
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex3a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex4.cs87
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex4.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex4a.cs87
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex4a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex5.cs89
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex5.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex5a.cs89
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex5a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex6.cs94
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex6.csproj40
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex6a.cs94
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex6a.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex7.cs76
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex7.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex7a.cs76
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex7a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex8.cs76
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex8.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex8a.cs76
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex8a.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex9.cs100
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex9.csproj40
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex9a.cs100
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallex9a.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitall/waitallnullarray.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/emptyarray.cs41
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/nullarray.cs41
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/nullarraymember.cs41
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/nullarraymemberwaitany.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyemptyarray.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex1.cs65
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex1.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex10.cs104
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex10.csproj40
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex10a.cs104
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex10a.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex1a.cs65
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex1a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex2.cs68
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex2.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex2a.cs68
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex2a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex3.cs81
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex3.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex3a.cs81
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex3a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex4.cs76
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex4.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex4a.cs76
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex4a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex5.cs85
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex5.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex5a.cs85
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex5a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex6.cs97
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex6.csproj40
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex6a.cs97
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex6a.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex7.cs69
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex7.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex7a.cs69
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex7a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex8.cs59
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex8.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex8a.cs59
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex8a.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex9.cs102
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex9.csproj40
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex9a.cs102
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanyex9a.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitany/waitanynullarray.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waithandlecommon.cs16
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex1.cs58
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex1.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex1a.cs58
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex1a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex2.cs59
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex2.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex2a.cs59
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex2a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex3.cs59
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex3.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex3a.cs59
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex3a.csproj38
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex4.cs57
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex4.csproj39
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex4a.cs57
-rw-r--r--tests/src/baseservices/threading/waithandle/waitone/waitoneex4a.csproj38
-rw-r--r--tests/src/baseservices/varargs/varargsupport.il114
-rw-r--r--tests/src/baseservices/varargs/varargsupport.ilproj40
-rw-r--r--tests/src/baseservices/varargs/varargsupport_r.ilproj37
-rw-r--r--tests/src/baseservices/visibility/Target.csproj45
-rw-r--r--tests/src/baseservices/visibility/target.cs520
1178 files changed, 88614 insertions, 0 deletions
diff --git a/tests/src/baseservices/compilerservices/dynamicobjectproperties/Dev10_535767.csproj b/tests/src/baseservices/compilerservices/dynamicobjectproperties/Dev10_535767.csproj
new file mode 100644
index 0000000000..b80575f47a
--- /dev/null
+++ b/tests/src/baseservices/compilerservices/dynamicobjectproperties/Dev10_535767.csproj
@@ -0,0 +1,47 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="dev10_535767.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <ItemGroup>
+ <NoWarn Include="42016,42020,42025,42024" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/compilerservices/dynamicobjectproperties/TestAPIs.csproj b/tests/src/baseservices/compilerservices/dynamicobjectproperties/TestAPIs.csproj
new file mode 100644
index 0000000000..1283589d54
--- /dev/null
+++ b/tests/src/baseservices/compilerservices/dynamicobjectproperties/TestAPIs.csproj
@@ -0,0 +1,48 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="helper.cs" />
+ <Compile Include="testapis.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <ItemGroup>
+ <NoWarn Include="42016,42020,42025,42024" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/compilerservices/dynamicobjectproperties/TestGC.csproj b/tests/src/baseservices/compilerservices/dynamicobjectproperties/TestGC.csproj
new file mode 100644
index 0000000000..8b3e45163d
--- /dev/null
+++ b/tests/src/baseservices/compilerservices/dynamicobjectproperties/TestGC.csproj
@@ -0,0 +1,48 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="helper.cs" />
+ <Compile Include="testgc.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <ItemGroup>
+ <NoWarn Include="42016,42020,42025,42024" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/compilerservices/dynamicobjectproperties/TestOverrides.csproj b/tests/src/baseservices/compilerservices/dynamicobjectproperties/TestOverrides.csproj
new file mode 100644
index 0000000000..be4c5a6463
--- /dev/null
+++ b/tests/src/baseservices/compilerservices/dynamicobjectproperties/TestOverrides.csproj
@@ -0,0 +1,48 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="helper.cs" />
+ <Compile Include="testoverrides.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <ItemGroup>
+ <NoWarn Include="42016,42020,42025,42024" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/compilerservices/dynamicobjectproperties/dev10_535767.cs b/tests/src/baseservices/compilerservices/dynamicobjectproperties/dev10_535767.cs
new file mode 100644
index 0000000000..19c15b587e
--- /dev/null
+++ b/tests/src/baseservices/compilerservices/dynamicobjectproperties/dev10_535767.cs
@@ -0,0 +1,434 @@
+// 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.
+//
+// Basic test for dependent handles.
+//
+// Note that though this test uses ConditionalWeakTable it is not a test for that class. This is a stress
+// test that utilizes ConditionalWeakTable features, which would be used heavily if Dynamic Language Runtime
+// catches on.
+//
+// Basic test overview:
+// * Allocate an array of objects (we call these Nodes) with finalizers.
+// * Create a set of dependent handles that reference these objects as primary and secondary members (this is
+// where ConditionalWeakTable comes in, adding a key/value pair to such a table creates a dependent handle
+// with the primary set to the key and the secondary set to the value).
+// * Null out selected objects from the array in various patterns. This removes the only normal strong root
+// for such objects (leaving only the dependent handles to provide additional roots).
+// * Perform a full GC and wait for it and finalization to complete. Each object which is collected will use
+// its finalizer to inform the test that it's been disposed of.
+// * Run our own reachability analysis (a simple mark array approach) to build a picture of which objects in
+// the array should have been collected or not.
+// * Validate that the actual set of live objects matches our computed live set exactly.
+//
+// Test variations include the number of objects allocated, the relationship between the primary and secondary
+// in each handle we allocate and the pattern with which we null out object references in the array.
+//
+// Additionally this test stresses substantially more complex code paths in the GC if server mode is enabled.
+// This can be achieved by setting the environment variable COMPlus_BuildFlavor=svr prior to executing the
+// test executable.
+//
+// Note that we don't go to any lengths to ensure that dependent handle ownership is spread over multiple cpus
+// on a server GC/MP test run. For large node counts (e.g. 100000) this happens naturally since initialization
+// takes a while with multiple thread/CPU switches involved. We could be more explicit here (allocate handles
+// using CPU affinitized threads) but if we do that we'd probably better look into different patterns of node
+// ownership to avoid unintentionally restricting our test coverage.
+//
+// Another area into which we could look deeper is trying to force mark stack overflows in the GC (presumably
+// by allocating complex object graphs with lots of interconnections, though I don't the specifics of the best
+// way to force this). Causing mark stack overflows should open up a class of bug the old dependent handle
+// implementation was subject to without requiring server GC mode or multiple CPUs.
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+// How we assign nodes to dependent handles.
+enum TableStyle
+{
+ Unconnected, // The primary and secondary handles are assigned completely disjoint objects
+ ForwardLinked, // The primary of each handle is the secondary of the previous handle
+ BackwardLinked, // The primary of each handle is the secondary of the next handle
+ Random // The primaries are each object in sequence, the secondaries are selected randomly from
+ // the same set
+}
+
+// How we choose object references in the array to null out (and thus potentially become collected).
+enum CollectStyle
+{
+ None, // Don't null out any (nothing should be collected)
+ All, // Null them all out (any remaining live objects should be collected)
+ Alternate, // Null out every second reference
+ Random // Null out each entry with a 50% probability
+}
+
+// We report errors by throwing an exception. Define our own Exception subclass so we can identify these
+// errors unambiguously.
+class TestException : Exception
+{
+ // We just supply a simple message string on error.
+ public TestException(string message) : base(message)
+ {
+ }
+}
+
+// Class encapsulating test runs over a set of objects/handles allocated with the specified TableStyle.
+class TestSet
+{
+ // Create a new test with the given table style and object count.
+ public TestSet(TableStyle ts, int count)
+ {
+ // Use one random number generator for the life of the test. Could support explicit seeds for
+ // reproducible tests here.
+ m_rng = new Random();
+
+ // Remember our parameters.
+ m_count = count;
+ m_style = ts;
+
+ // Various arrays.
+ m_nodes = new Node[count]; // The array of objects
+ m_collected = new bool[count]; // Records whether each object has been collected (entries are set by
+ // the finalizer on Node)
+ m_marks = new bool[count]; // Array used during individual test runs to calculate whether each
+ // object should still be alive (allocated once here to avoid
+ // injecting further garbage collections at run time)
+
+ // Allocate each object (Node). Each knows its own unique ID (the index into the node array) and has a
+ // back pointer to this test object (so it can phone home to report its own collection at finalization
+ // time).
+ for (int i = 0; i < count; i++)
+ m_nodes[i] = new Node(this, i);
+
+ // Determine how many handles we need to allocate given the number of nodes. This varies based on the
+ // table style.
+ switch (ts)
+ {
+ case TableStyle.Unconnected:
+ // Primaries and secondaries are completely different objects so we split our nodes in half and
+ // allocate that many handles.
+ m_handleCount = count / 2;
+ break;
+
+ case TableStyle.ForwardLinked:
+ // Nodes are primaries in one handle and secondary in another except one that falls off the end.
+ // So we have as many handles as nodes - 1.
+ m_handleCount = count - 1;
+ break;
+
+ case TableStyle.BackwardLinked:
+ // Nodes are primaries in one handle and secondary in another except one that falls off the end.
+ // So we have as many handles as nodes - 1.
+ m_handleCount = count - 1;
+ break;
+
+ case TableStyle.Random:
+ // Each node is a primary in some handle (secondaries are selected from amongst all the same nodes
+ // randomly). So we have as many nodes as handles.
+ m_handleCount = count;
+ break;
+ }
+
+ // Allocate an array of HandleSpecs. These aren't the real handles, just structures that allow us
+ // remember what's in each handle (in terms of the node index number for the primary and secondary).
+ // We need to track this information separately because we can't access the real handles directly
+ // (ConditionalWeakTable hides them) and we need to recall exactly what the primary and secondary of
+ // each handle is so we can compute our own notion of object liveness later.
+ m_handles = new HandleSpec[m_handleCount];
+
+ // Initialize the handle specs to assign objects to handles based on the table style.
+ for (int i = 0; i < m_handleCount; i++)
+ {
+ int primary = -1, secondary = -1;
+
+ switch (ts)
+ {
+ case TableStyle.Unconnected:
+ // Assign adjacent nodes to the primary and secondary of each handle.
+ primary = i * 2;
+ secondary = (i * 2) + 1;
+ break;
+
+ case TableStyle.ForwardLinked:
+ // Primary of each handle is the secondary of the last handle.
+ primary = i;
+ secondary = i + 1;
+ break;
+
+ case TableStyle.BackwardLinked:
+ // Primary of each handle is the secondary of the next handle.
+ primary = i + 1;
+ secondary = i;
+ break;
+
+ case TableStyle.Random:
+ // Primary is each node in sequence, secondary is any of the nodes randomly.
+ primary = i;
+ secondary = m_rng.Next(m_handleCount);
+ break;
+ }
+
+ m_handles[i].Set(primary, secondary);
+ }
+
+ // Allocate a ConditionalWeakTable mapping Node keys to Node values.
+ m_table = new ConditionalWeakTable<Node, Node>();
+
+ // Using our handle specs computed above add each primary/secondary node pair to the
+ // ConditionalWeakTable in turn. This causes the ConditionalWeakTable to allocate a dependent handle
+ // for each entry with the primary and secondary objects we specified as keys and values (note that
+ // this scheme prevents us from creating multiple handles with the same primary though if this is
+ // desired we could achieve it by allocating multiple ConditionalWeakTables).
+ for (int i = 0; i < m_handleCount; i++)
+ m_table.Add(m_nodes[m_handles[i].m_primary], m_nodes[m_handles[i].m_secondary]);
+ }
+
+ // Call this method to indicate a test error with a given message. This will terminate the test
+ // immediately.
+ void Error(string message)
+ {
+ throw new TestException(message);
+ }
+
+ // Run a single test pass on the node set. Null out node references according to the given CollectStyle,
+ // run a garbage collection and then verify that each node is either live or dead as we predict. Take care
+ // of the order in which test runs are made against a single TestSet: e.g. running a CollectStyle.All will
+ // collect all nodes, rendering further runs relatively uninteresting.
+ public void Run(CollectStyle cs)
+ {
+ Console.WriteLine("Running test TS:{0} CS:{1} {2} entries...",
+ Enum.GetName(typeof(TableStyle), m_style),
+ Enum.GetName(typeof(CollectStyle), cs),
+ m_count);
+
+ // Iterate over the array of nodes deciding for each whether to sever the reference (null out the
+ // entry).
+ for (int i = 0; i < m_count; i++)
+ {
+ bool sever = false;
+ switch (cs)
+ {
+ case CollectStyle.All:
+ // Sever all references.
+ sever = true;
+ break;
+
+ case CollectStyle.None:
+ // Don't sever any references.
+ break;
+
+ case CollectStyle.Alternate:
+ // Sever every second reference (starting with the first).
+ if ((i % 2) == 0)
+ sever = true;
+ break;
+
+ case CollectStyle.Random:
+ // Sever any reference with a 50% probability.
+ if (m_rng.Next(100) > 50)
+ sever = true;
+ break;
+ }
+
+ if (sever)
+ m_nodes[i] = null;
+ }
+
+ // Initialize a full GC and wait for all finalizers to complete (so we get an accurate picture of
+ // which nodes were collected).
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+
+ // Calculate our own view of which nodes should be alive or dead. Use a simple mark array for this.
+ // Once the algorithm is complete a true value at a given index in the array indicates a node that
+ // should still be alive, otherwise the node should have been collected.
+
+ // Initialize the mark array. Set true for nodes we still have a strong reference to from the array
+ // (these should definitely not have been collected yet). Set false for the other nodes (we assume
+ // they must have been collected until we prove otherwise).
+ for (int i = 0; i < m_count; i++)
+ m_marks[i] = m_nodes[i] != null;
+
+ // Perform multiple passes over the handles we allocated (or our recorded version of the handles at
+ // least). If we find a handle with a marked (live) primary where the secondary is not yet marked then
+ // go ahead and mark that secondary (dependent handles are defined to do this: primaries act as if
+ // they have a strong reference to the secondary up until the point they are collected). Repeat this
+ // until we manage a scan over the entire table without marking any additional nodes as live. At this
+ // point the marks array should reflect which objects are still live.
+ while (true)
+ {
+ // Assume we're not going any further nodes to mark as live.
+ bool marked = false;
+
+ // Look at each handle in turn.
+ for (int i = 0; i < m_handleCount; i++)
+
+ if (m_marks[m_handles[i].m_primary])
+ {
+ // Primary is live.
+ if (!m_marks[m_handles[i].m_secondary])
+ {
+ // Secondary wasn't marked as live yet. Do so and remember that we marked at least
+ // node as live this pass (so we need to loop again since this secondary could be the
+ // same as a primary earlier in the table).
+ m_marks[m_handles[i].m_secondary] = true;
+ marked = true;
+ }
+ }
+
+ // Terminate the loop if we scanned the entire table without marking any additional nodes as live
+ // (since additional scans can't make any difference).
+ if (!marked)
+ break;
+ }
+
+ // Validate our view of node liveness (m_marks) correspond to reality (m_nodes and m_collected).
+ for (int i = 0; i < m_count; i++)
+ {
+ // Catch nodes which still have strong references but have collected anyway. This is stricly a
+ // subset of the next test but it would be a very interesting bug to call out.
+ if (m_nodes[i] != null && m_collected[i])
+ Error(String.Format("Node {0} was collected while it still had a strong root", i));
+
+ // Catch nodes which we compute as alive but have been collected.
+ if (m_marks[i] && m_collected[i])
+ Error(String.Format("Node {0} was collected while it was still reachable", i));
+
+ // Catch nodes which we compute as dead but haven't been collected.
+ if (!m_marks[i] && !m_collected[i])
+ Error(String.Format("Node {0} wasn't collected even though it was unreachable", i));
+ }
+ }
+
+ // Method called by nodes when they're finalized (i.e. the node has been collected).
+ public void Collected(int id)
+ {
+ // Catch nodes which are collected twice.
+ if (m_collected[id])
+ Error(String.Format("Node {0} collected twice", id));
+
+ m_collected[id] = true;
+ }
+
+ // Structure used to record the primary and secondary nodes in every dependent handle we allocated. Nodes
+ // are identified by ID (their index into the node array).
+ struct HandleSpec
+ {
+ public int m_primary;
+ public int m_secondary;
+
+ public void Set(int primary, int secondary)
+ {
+ m_primary = primary;
+ m_secondary = secondary;
+ }
+ }
+
+ int m_count; // Count of nodes in array
+ TableStyle m_style; // Style of handle creation
+ Node[] m_nodes; // Array of nodes
+ bool[] m_collected; // Array indicating which nodes have been collected
+ bool[] m_marks; // Array indicating which nodes should be live
+ ConditionalWeakTable<Node, Node> m_table; // Table that creates and holds our dependent handles
+ int m_handleCount; // Number of handles we create
+ HandleSpec[] m_handles; // Array of descriptions of each handle
+ Random m_rng; // Random number generator
+}
+
+// The type of object we reference from our dependent handles. Doesn't do much except report its own garbage
+// collection to the owning TestSet.
+class Node
+{
+ // Allocate a node and remember our owner (TestSet) and ID (index into node array).
+ public Node(TestSet owner, int id)
+ {
+ m_owner = owner;
+ m_id = id;
+ }
+
+ // On finalization report our collection to the owner TestSet.
+ ~Node()
+ {
+ m_owner.Collected(m_id);
+ }
+
+ TestSet m_owner; // TestSet which created us
+ int m_id; // Our index into above TestSet's node array
+}
+
+// The test class itself.
+class DhTest1
+{
+ // Entry point.
+ public static int Main()
+ {
+ // The actual test runs are controlled from RunTest. True is returned if all succeeded, false
+ // otherwise.
+ if (new DhTest1().RunTest())
+ {
+ Console.WriteLine("Test PASS");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test FAIL");
+ return 999;
+ }
+ }
+
+ // Run a series of tests with different table and collection styles.
+ bool RunTest()
+ {
+ // Number of nodes we'll allocate in each run (we could take this as an argument instead).
+ int numNodes = 10000;
+
+ // Run everything under an exception handler since test errors are reported as exceptions.
+ try
+ {
+ // Run a pass with each table style. For each style run through the collection styles in the order
+ // None, Alternate, Random and All. This sequence is carefully selected to remove progressively
+ // more nodes from the array (since, within a given TestSet instance, once a node has actually
+ // been collected it won't be resurrected for future runs).
+
+ TestSet ts1 = new TestSet(TableStyle.Unconnected, numNodes);
+ ts1.Run(CollectStyle.None);
+ ts1.Run(CollectStyle.Alternate);
+ ts1.Run(CollectStyle.Random);
+ ts1.Run(CollectStyle.All);
+
+ TestSet ts2 = new TestSet(TableStyle.ForwardLinked, numNodes);
+ ts2.Run(CollectStyle.None);
+ ts2.Run(CollectStyle.Alternate);
+ ts2.Run(CollectStyle.Random);
+ ts2.Run(CollectStyle.All);
+
+ TestSet ts3 = new TestSet(TableStyle.BackwardLinked, numNodes);
+ ts3.Run(CollectStyle.None);
+ ts3.Run(CollectStyle.Alternate);
+ ts3.Run(CollectStyle.Random);
+ ts3.Run(CollectStyle.All);
+
+ TestSet ts4 = new TestSet(TableStyle.Random, numNodes);
+ ts4.Run(CollectStyle.None);
+ ts4.Run(CollectStyle.Alternate);
+ ts4.Run(CollectStyle.Random);
+ ts4.Run(CollectStyle.All);
+ }
+ catch (TestException te)
+ {
+ // "Expected" errors.
+ Console.WriteLine("TestError: {0}", te.Message);
+ return false;
+ }
+ catch (Exception e)
+ {
+ // Totally unexpected errors (probably shouldn't see these unless there's a test bug).
+ Console.WriteLine("Unexpected exception: {0}", e.GetType().Name);
+ return false;
+ }
+
+ // If we get as far as here the test succeeded.
+ return true;
+ }
+}
+
diff --git a/tests/src/baseservices/compilerservices/dynamicobjectproperties/helper.cs b/tests/src/baseservices/compilerservices/dynamicobjectproperties/helper.cs
new file mode 100644
index 0000000000..287ccfd962
--- /dev/null
+++ b/tests/src/baseservices/compilerservices/dynamicobjectproperties/helper.cs
@@ -0,0 +1,60 @@
+// 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.Runtime.CompilerServices;
+
+public class RefX1<T>
+{
+ T _val;
+ public RefX1(T t) { _val = t; }
+
+ public override bool Equals(object obj)
+ {
+ RefX1<T> b = obj as RefX1<T>;
+ if (b == null)
+ {
+ return false;
+ }
+ return this._val.Equals(b._val);
+ }
+
+ public override int GetHashCode()
+ {
+ return this._val.GetHashCode();
+ }
+
+}
+
+public class Test
+{
+ public static bool result = true;
+ public static bool Eval(bool exp)
+ {
+ return Eval(exp, null);
+ }
+ public static bool Eval(bool exp, String errorMsg)
+ {
+ if (!exp)
+ {
+ //This would never be reset, since we start with true and only set it to false if the Eval fails
+ result = exp;
+ String err = errorMsg;
+ if (err == null)
+ err = "Test Failed";
+ Console.WriteLine(err);
+ }
+
+ return exp;
+ }
+
+ public static bool Eval(bool exp, String format, params object[] arg)
+ {
+ if (!exp)
+ {
+ return Eval(exp, String.Format(format, arg));
+ }
+
+ return true;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/compilerservices/dynamicobjectproperties/test448035.cs b/tests/src/baseservices/compilerservices/dynamicobjectproperties/test448035.cs
new file mode 100644
index 0000000000..533589eb27
--- /dev/null
+++ b/tests/src/baseservices/compilerservices/dynamicobjectproperties/test448035.cs
@@ -0,0 +1,45 @@
+// 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.Runtime.CompilerServices;
+
+class Test
+{
+ int countdown;
+
+ Test(int n)
+ {
+ countdown = n;
+ }
+
+ ~Test()
+ {
+ if (countdown > 0)
+ {
+ new Test(countdown - 1).ToString();
+ }
+
+ for (int i = 0; i < 1000; i++)
+ {
+ table.Add(new Object(), new Object());
+ }
+ }
+
+
+ static ConditionalWeakTable<Object,Object> table = new ConditionalWeakTable<Object,Object>();
+
+ public static int Main()
+ {
+ for (int i = 0; i < 10; i++)
+ {
+ table.Add(new Object(), new Object());
+ }
+
+ new Test(5).ToString();
+
+ Console.WriteLine("PASS: Test did not assert");
+ return 100;
+ }
+}
+ \ No newline at end of file
diff --git a/tests/src/baseservices/compilerservices/dynamicobjectproperties/test448035.csproj b/tests/src/baseservices/compilerservices/dynamicobjectproperties/test448035.csproj
new file mode 100644
index 0000000000..9e80124999
--- /dev/null
+++ b/tests/src/baseservices/compilerservices/dynamicobjectproperties/test448035.csproj
@@ -0,0 +1,47 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="test448035.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <ItemGroup>
+ <NoWarn Include="42016,42020,42025,42024" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/compilerservices/dynamicobjectproperties/testapis.cs b/tests/src/baseservices/compilerservices/dynamicobjectproperties/testapis.cs
new file mode 100644
index 0000000000..3e352527f0
--- /dev/null
+++ b/tests/src/baseservices/compilerservices/dynamicobjectproperties/testapis.cs
@@ -0,0 +1,583 @@
+// 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.Runtime.CompilerServices;
+using System.Collections.Generic;
+
+public class Driver<K, V>
+ where K : class
+ where V : class
+{
+ public void BasicAdd(K[] keys, V[] values)
+ {
+ ConditionalWeakTable<K,V> tbl = new ConditionalWeakTable<K,V>();
+
+ for (int i = 0; i < keys.Length; i++)
+ {
+ tbl.Add(keys[i], values[i]);
+ }
+
+ for (int i = 0; i < keys.Length; i++)
+ {
+ V val;
+
+ // make sure TryGetValues return true, since the key should be in the table
+ Test.Eval(tbl.TryGetValue(keys[i], out val), "Err_001 Expected TryGetValue to return true");
+
+ if ( val == null && values[i] == null )
+ {
+ Test.Eval(true);
+ }
+ else if (val != null && values[i] != null && val.Equals(values[i]))
+ {
+ Test.Eval(true);
+ }
+ else
+ {
+ // only one of the values is null or the values don't match
+ Test.Eval(false, "Err_002 The value returned by TryGetValue doesn't match the expected value");
+ }
+ }
+ }
+
+ public void AddSameKey //Same Value - Different Value should not matter
+ (K[] keys, V[] values, int index, int repeat)
+ {
+ ConditionalWeakTable<K,V> tbl = new ConditionalWeakTable<K,V>();
+
+ for (int i = 0; i < keys.Length; i++)
+ {
+ tbl.Add(keys[i], values[i]);
+ }
+
+ for (int i = 0; i < repeat; i++)
+ {
+ try
+ {
+ tbl.Add(keys[index], values[index]);
+ Test.Eval(false, "Err_003 Expected to get ArgumentException when invoking Add() on an already existing key");
+ }
+ catch (ArgumentException)
+ {
+ Test.Eval(true);
+ }
+ }
+ }
+
+ public void AddValidations(K[] keys, V[] values, V value)
+ {
+ ConditionalWeakTable<K,V> tbl = new ConditionalWeakTable<K,V>();
+
+ for (int i = 0; i < keys.Length; i++)
+ {
+ tbl.Add(keys[i], values[i]);
+ }
+
+ //try to add null key
+ try
+ {
+ tbl.Add(null, value);
+ Test.Eval(false, "Err_004 Expected to get ArgumentNullException when invoking Add() on a null key");
+ }
+ catch (ArgumentNullException)
+ {
+ Test.Eval(true);
+ }
+ }
+
+ public void RemoveValidations(K[] keys, V[] values, K key, V value)
+ {
+ ConditionalWeakTable<K,V> tbl = new ConditionalWeakTable<K,V>();
+
+ // Try to remove key from an empty dictionary
+ Random r = new Random();
+
+ // Remove should return false
+ Test.Eval(!tbl.Remove(keys[0]), "Err_005 Expected Remove to return false");
+
+
+ for (int i = 0; i < keys.Length; i++)
+ {
+ tbl.Add(keys[i], values[i]);
+ }
+
+ //try to remove null key
+ try
+ {
+ tbl.Remove(null);
+ Test.Eval(false, "Err_006 Expected to get ArgumentNullException when invoking Remove() on a null key");
+ }
+ catch (ArgumentNullException)
+ {
+ Test.Eval(true);
+ }
+
+ // Remove non existing key
+ // Remove should return false
+ Test.Eval(!tbl.Remove(key), "Err_007 Expected Remove to return false");
+ }
+
+ public void TryGetValueValidations(K[] keys, V[] values, K key, V value)
+ {
+ ConditionalWeakTable<K,V> tbl = new ConditionalWeakTable<K,V>();
+
+ V val;
+
+ // Try to get key from an empty dictionary
+ // TryGetValue should return false and value should contian default(TValue)
+ Test.Eval(!tbl.TryGetValue(keys[0], out val), "Err_008 Expected TryGetValue to return false");
+ Test.Eval(val == null, "Err_009 Expected val to be null");
+
+ for (int i = 0; i < keys.Length; i++)
+ {
+ tbl.Add(keys[i], values[i]);
+ }
+
+ //try to get null key
+ try
+ {
+ tbl.TryGetValue(null, out val);
+ Test.Eval(false, "Err_010 Expected to get ArgumentNullException when invoking TryGetValue() on a null key");
+ }
+ catch (ArgumentNullException)
+ {
+ Test.Eval(true);
+ }
+
+ // Try to get non existing key
+ // TryGetValue should return false and value should contian default(TValue)
+ Random r = new Random();
+ Test.Eval(!tbl.TryGetValue(key, out val), "Err_011 Expected TryGetValue to return false");
+ Test.Eval(val == null, "Err_012 Expected val to be null");
+ }
+
+
+ public Dictionary<string, string> g_stringDict = new Dictionary<string, string>();
+ public Dictionary<RefX1<int>, string> g_refIntDict = new Dictionary<RefX1<int>, string>();
+ public Dictionary<RefX1<string>, string> g_refStringDict = new Dictionary<RefX1<string>, string>();
+
+
+ public void GenerateValuesForStringKeys(string[] stringArr)
+ {
+ for (int i = 0; i < 100; ++i)
+ {
+ g_stringDict.Add(stringArr[i], stringArr[i]);
+ }
+ }
+
+ public void GenerateValuesForIntRefKeys(RefX1<int>[] refIntArr, string[] stringArr)
+ {
+ for (int i = 0; i < 100; ++i)
+ {
+ g_refIntDict.Add(refIntArr[i], stringArr[i]);
+ }
+ }
+
+ public void GenerateValuesForStringRefKeys(RefX1<string>[] refStringArr, string[] stringArr)
+ {
+ for (int i = 0; i < 100; ++i)
+ {
+ g_refStringDict.Add(refStringArr[i], stringArr[i]);
+ }
+ }
+
+
+ //This method is used for the mscorlib defined delegate
+ // public delegate V CreateValueCallback(K key);
+ public V CreateValue(K key)
+ {
+ if (key is string)
+ {
+ return g_stringDict[key as string] as V;
+ }
+ else if (key is RefX1<int>)
+ {
+ return g_refIntDict[key as RefX1<int>] as V;
+ }
+ else if (key is RefX1<string>)
+ {
+ return g_refStringDict[key as RefX1<string>] as V;
+ }
+
+ Test.Eval(false, "Err_12a Unknown type of key provided to CreateValue()");
+ return null;
+
+ }
+
+ public void VerifyValue(K key, V val)
+ {
+ V expectedVal;
+
+ if (key is string)
+ {
+ expectedVal = g_stringDict[key as string] as V;
+ }
+ else if (key is RefX1<int>)
+ {
+ expectedVal = g_refIntDict[key as RefX1<int>] as V;
+ }
+ else if (key is RefX1<string>)
+ {
+ expectedVal = g_refStringDict[key as RefX1<string>] as V;
+ }
+ else
+ {
+ Test.Eval(false, "Err_12e Incorrect key type supplied");
+ return;
+ }
+
+ if (!val.Equals(expectedVal))
+ {
+ Test.Eval(false, "Err_12b The value returned by TryGetValue doesn't match the expected value for key: " + key +
+ "\nExpected value: " + expectedVal + "; Actual: " + val);
+ }
+ }
+
+ public void GetValueValidations(K[] keys, V[] values)
+ {
+ ConditionalWeakTable<K,V>.CreateValueCallback valueCallBack =
+ new ConditionalWeakTable<K,V>.CreateValueCallback(CreateValue);
+
+ ConditionalWeakTable<K,V> tbl = new ConditionalWeakTable<K,V>();
+
+ K key = keys[0];
+
+ // Get key from an empty dictionary
+ // GetValue should return the new value generated from CreateValue()
+ tbl.GetValue(key, valueCallBack);
+
+ // check that this opeartion added the (key,value) pair to the dictionary
+ V val;
+
+ Test.Eval(tbl.TryGetValue(key, out val));
+ VerifyValue(key, val);
+
+ // now add values to the table
+ for (int i = 1; i < keys.Length; i++)
+ {
+ try
+ {
+ tbl.Add(keys[i], values[i]);
+ }
+ catch (ArgumentException) { }
+ }
+
+ // try to get value for a key that already exists in the table
+ tbl.GetValue(keys[55], valueCallBack);
+
+ Test.Eval(tbl.TryGetValue(keys[55], out val));
+ VerifyValue(keys[55], val);
+
+
+ //try to get null key
+ try
+ {
+ tbl.GetValue(null, valueCallBack);
+ Test.Eval(false, "Err_010 Expected to get ArgumentNullException when invoking TryGetValue() on a null key");
+ }
+ catch (ArgumentNullException)
+ {
+ Test.Eval(true);
+ }
+
+ // try to use null callback
+ try
+ {
+ valueCallBack = null;
+ tbl.GetValue(key, valueCallBack);
+ Test.Eval(false, "Err_010 Expected to get ArgumentNullException when invoking TryGetValue() on a null callback");
+ }
+ catch (ArgumentNullException)
+ {
+ Test.Eval(true);
+ }
+ }
+
+ // The method first adds some keys to the table
+ // Then removes a key, checks that it was removed, adds the same key and verifies that it was added.
+ public void AddRemoveKeyValPair(K[] keys, V[] values, int index, int repeat)
+ {
+ ConditionalWeakTable<K,V> tbl = new ConditionalWeakTable<K,V>();
+
+ for (int i = 0; i < keys.Length; i++)
+ {
+ tbl.Add(keys[i], values[i]);
+ }
+
+ for (int i = 0; i < repeat; i++)
+ {
+ // remove existing key and ensure method return true
+ Test.Eval(tbl.Remove(keys[index]), "Err_013 Expected Remove to return true");
+
+ V val;
+ // since we removed the key, TryGetValue should return false
+ Test.Eval(!tbl.TryGetValue(keys[index], out val), "Err_014 Expected TryGetValue to return false");
+
+ Test.Eval(val == null, "Err_015 Expected val to be null");
+
+ // next add the same key
+ tbl.Add(keys[index], values[index]);
+
+ // since we added the key, TryGetValue should return true
+ Test.Eval(tbl.TryGetValue(keys[index], out val), "Err_016 Expected TryGetValue to return true");
+
+ if (val == null && values[i] == null)
+ {
+ Test.Eval(true);
+ }
+ else if (val != null && values[index] != null && val.Equals(values[index]))
+ {
+ Test.Eval(true);
+ }
+ else
+ {
+ // only one of the values is null or the values don't match
+ Test.Eval(false, "Err_017 The value returned by TryGetValue doesn't match the expected value");
+ }
+ }
+ }
+
+ public void BasicGetOrCreateValue(K[] keys)
+ {
+ V[] values = new V[keys.Length];
+
+ ConditionalWeakTable<K,V> tbl = new ConditionalWeakTable<K,V>();
+
+ // assume additions for all values
+ for (int i = 0; i < keys.Length; i++)
+ {
+ values[i] = tbl.GetOrCreateValue(keys[i]);
+ }
+
+ for (int i = 0; i < keys.Length; i++)
+ {
+ V val;
+
+ // make sure TryGetValues return true, since the key should be in the table
+ Test.Eval(tbl.TryGetValue(keys[i], out val), "Err_018 Expected TryGetValue to return true");
+
+ if (val == null || !val.Equals(values[i]))
+ {
+ // only one of the values is null or the values don't match
+ Test.Eval(false, "Err_019 The value returned by TryGetValue doesn't match the object created via the default constructor");
+ }
+ }
+ }
+
+
+ public void BasicAddThenGetOrCreateValue(K[] keys, V[] values)
+ {
+ ConditionalWeakTable<K,V> tbl = new ConditionalWeakTable<K,V>();
+
+ // assume additions for all values
+ for (int i = 0; i < keys.Length; i++)
+ {
+ tbl.Add(keys[i], values[i]);
+ }
+
+ for (int i = 0; i < keys.Length; i++)
+ {
+ V val;
+
+ // make sure GetOrCreateValues the value added (and not a new object)
+ val = tbl.GetOrCreateValue(keys[i]);
+
+ if (val == null || !val.Equals(values[i]))
+ {
+ // only one of the values is null or the values don't match
+ Test.Eval(false, "Err_020 The value returned by GetOrCreateValue doesn't match the object added");
+ }
+ }
+ }
+}
+
+public class NoDefaultConstructor
+{
+ public NoDefaultConstructor(string str)
+ {
+ }
+}
+
+public class WithDefaultConstructor
+{
+ private string str;
+
+ public WithDefaultConstructor()
+ {
+ }
+
+ public WithDefaultConstructor(string s)
+ {
+ str = s;
+ }
+
+ public new bool Equals(object obj)
+ {
+ WithDefaultConstructor wdc = (WithDefaultConstructor)obj;
+
+ return (wdc.str.Equals(str));
+ }
+
+}
+
+public class NegativeTestCases
+{
+ public static void NoDefaulConstructor()
+ {
+ ConditionalWeakTable<string,NoDefaultConstructor> tbl = new ConditionalWeakTable<string,NoDefaultConstructor>();
+
+ try
+ {
+ tbl.GetOrCreateValue("string1");
+
+ Test.Eval(false, "Err_021 MissingMethodException execpted");
+ }
+ catch (Exception e)
+ {
+ Test.Eval(typeof(MissingMethodException) == e.GetType(), "Err_022 Incorrect exception thrown: " + e);
+ }
+ }
+}
+
+public class TestAPIs
+{
+ public static int Main()
+ {
+ Random r = new Random();
+
+ try
+ {
+ // test for ConditionalWeakTable<string>
+ Driver<string,string> stringDriver = new Driver<string,string>();
+
+ string[] stringArr = new string[100];
+ for (int i = 0; i < 100; i++)
+ {
+ stringArr[i] = "SomeTestString" + i.ToString();
+ }
+
+ // test with generic object
+ // test for ConditionalWeakTable<RefX1<int>>
+ Driver<string,RefX1<int>> refIntDriver = new Driver<string,RefX1<int>>();
+
+ RefX1<int>[] refIntArr = new RefX1<int>[100];
+ for (int i = 0; i < 100; i++)
+ {
+ refIntArr[i] = new RefX1<int>(i);
+ }
+
+ // test with generic object
+ // test for ConditionalWeakTable<RefX1<string>>
+ Driver<string, RefX1<string>> refStringDriver = new Driver<string,RefX1<string>>();
+
+ RefX1<string>[] refStringArr = new RefX1<string>[100];
+ for (int i = 0; i < 100; i++)
+ {
+ refStringArr[i] = new RefX1<string>("SomeTestString" + i.ToString());
+ }
+
+
+ stringDriver.BasicAdd(stringArr, stringArr);
+ refIntDriver.BasicAdd(stringArr, refIntArr);
+ refStringDriver.BasicAdd(stringArr, refStringArr);
+
+ //===============================================================
+ // test various boundary conditions
+ // - add/remove/lookup of null key
+ // - remove/lookup of non-existing key in an empty dictionary and a non-empty dictionary
+ stringDriver.AddValidations(stringArr, stringArr, stringArr[0]);
+ refIntDriver.AddValidations(stringArr, refIntArr, refIntArr[0]);
+ refStringDriver.AddValidations(stringArr, refStringArr, refStringArr[0]);
+
+ //===============================================================
+ stringDriver.RemoveValidations(stringArr, stringArr, r.Next().ToString(), stringArr[0]);
+ refIntDriver.RemoveValidations(stringArr, refIntArr, r.Next().ToString(), refIntArr[0]);
+ refStringDriver.RemoveValidations(stringArr, refStringArr, r.Next().ToString(), refStringArr[0]);
+
+ //===============================================================
+ stringDriver.TryGetValueValidations(stringArr, stringArr, r.Next().ToString(), stringArr[0]);
+ refIntDriver.TryGetValueValidations(stringArr, refIntArr, r.Next().ToString(), refIntArr[0]);
+ refStringDriver.TryGetValueValidations(stringArr, refStringArr, r.Next().ToString(), refStringArr[0]);
+
+ //===============================================================
+ // this method generates a dictionary with keys and values to be used for GetValue() method testing
+ stringDriver.GenerateValuesForStringKeys(stringArr);
+ stringDriver.GetValueValidations(stringArr, stringArr);
+
+ Driver<RefX1<int>, string> refIntDriver2 = new Driver<RefX1<int>, string>();
+ refIntDriver2.GenerateValuesForIntRefKeys(refIntArr, stringArr);
+ refIntDriver2.GetValueValidations(refIntArr,stringArr);
+
+ Driver<RefX1<string>, string> refStringDriver2 = new Driver<RefX1<string>, string>();
+ refStringDriver2.GenerateValuesForStringRefKeys(refStringArr, stringArr);
+ refStringDriver2.GetValueValidations(refStringArr, stringArr);
+
+ //===============================================================
+ stringDriver.AddSameKey(stringArr, stringArr, 0, 2);
+ stringDriver.AddSameKey(stringArr, stringArr, 99, 3);
+ stringDriver.AddSameKey(stringArr, stringArr, 50, 4);
+ stringDriver.AddSameKey(stringArr, stringArr, 1, 5);
+ stringDriver.AddSameKey(stringArr, stringArr, 98, 6);
+
+ refIntDriver.AddSameKey(stringArr, refIntArr, 0, 2);
+ refIntDriver.AddSameKey(stringArr, refIntArr, 99, 3);
+ refIntDriver.AddSameKey(stringArr, refIntArr, 50, 4);
+ refIntDriver.AddSameKey(stringArr, refIntArr, 1, 5);
+ refIntDriver.AddSameKey(stringArr, refIntArr, 98, 6);
+
+ refStringDriver.AddSameKey(stringArr, refStringArr, 0, 2);
+ refStringDriver.AddSameKey(stringArr, refStringArr, 99, 3);
+ refStringDriver.AddSameKey(stringArr, refStringArr, 50, 4);
+ refStringDriver.AddSameKey(stringArr, refStringArr, 1, 5);
+ refStringDriver.AddSameKey(stringArr, refStringArr, 98, 6);
+
+ //===============================================================
+ stringDriver.AddRemoveKeyValPair(stringArr, stringArr, 0, 2);
+ stringDriver.AddRemoveKeyValPair(stringArr, stringArr, 99, 3);
+ stringDriver.AddRemoveKeyValPair(stringArr, stringArr, 50, 4);
+ stringDriver.AddRemoveKeyValPair(stringArr, stringArr, 1, 5);
+ stringDriver.AddRemoveKeyValPair(stringArr, stringArr, 98, 6);
+
+ refIntDriver.AddRemoveKeyValPair(stringArr, refIntArr, 0, 2);
+ refIntDriver.AddRemoveKeyValPair(stringArr, refIntArr, 99, 3);
+ refIntDriver.AddRemoveKeyValPair(stringArr, refIntArr, 50, 4);
+ refIntDriver.AddRemoveKeyValPair(stringArr, refIntArr, 1, 5);
+ refIntDriver.AddRemoveKeyValPair(stringArr, refIntArr, 98, 6);
+
+ refStringDriver.AddRemoveKeyValPair(stringArr, refStringArr, 0, 2);
+ refStringDriver.AddRemoveKeyValPair(stringArr, refStringArr, 99, 3);
+ refStringDriver.AddRemoveKeyValPair(stringArr, refStringArr, 50, 4);
+ refStringDriver.AddRemoveKeyValPair(stringArr, refStringArr, 1, 5);
+ refStringDriver.AddRemoveKeyValPair(stringArr, refStringArr, 98, 6);
+
+ //==============================================================
+ // new tests for GetOrCreateValue
+ (new Driver<string, WithDefaultConstructor>()).BasicGetOrCreateValue(stringArr);
+ WithDefaultConstructor[] wvalues = new WithDefaultConstructor[stringArr.Length];
+ for (int i=0; i<wvalues.Length; i++) wvalues[i] = new WithDefaultConstructor(stringArr[i]);
+ (new Driver<string, WithDefaultConstructor>()).BasicAddThenGetOrCreateValue(stringArr, wvalues);
+
+ NegativeTestCases.NoDefaulConstructor();
+
+ //===============================================================
+ if (Test.result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 101;
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Test threw unexpected exception:\n{0}", e);
+ return 102;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/compilerservices/dynamicobjectproperties/testgc.cs b/tests/src/baseservices/compilerservices/dynamicobjectproperties/testgc.cs
new file mode 100644
index 0000000000..8e1de5e419
--- /dev/null
+++ b/tests/src/baseservices/compilerservices/dynamicobjectproperties/testgc.cs
@@ -0,0 +1,279 @@
+using System;
+using System.Runtime.CompilerServices;
+
+public class TestGC
+{
+
+ private static ConditionalWeakTable<string, string> tbl;
+ private static WeakReference[] weakRefKeyArr;
+ private static WeakReference[] weakRefValArr;
+
+ private static string key0;
+ private static string key21;
+ private static string key99;
+
+ private static string value0;
+ private static string value21;
+ private static string value99;
+
+ /*
+ * Ensure that a key that has no managed references to it gets automatically removed from the
+ * dictionary after GC happens. Also make sure the value gets gc’d as well.
+ */
+ public static void TestKeyWithNoReferences_Pass1(int length)
+ {
+ tbl = new ConditionalWeakTable<string, string>();
+
+ weakRefKeyArr = new WeakReference[length];
+ weakRefValArr = new WeakReference[length];
+
+ for (int i = 0; i < length; i++)
+ {
+ String key = "KeyTestString" + i.ToString();
+ String value = "ValueTestString" + i.ToString();
+ tbl.Add(key, value);
+
+ // create a weak reference for the key
+ weakRefKeyArr[i] = new WeakReference(key, true);
+ weakRefValArr[i] = new WeakReference(value, true);
+ }
+ }
+
+
+ public static void TestKeyWithNoReferences_Pass2(int length)
+ {
+ // force GC to happen
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ GC.Collect();
+
+
+ // note, this assignment will prevent the object from being collected if it isn’t already
+ for (int i = 0; i < length; i++)
+ {
+ Object targetKey = weakRefKeyArr[i].Target;
+ Object targetVal = weakRefValArr[i].Target;
+
+ if (targetKey == null && targetVal == null)
+ {
+ Console.WriteLine("Object at index " +i+ " was collected");
+
+ string val;
+ // the key should no longer be in the table
+ Test.Eval(!tbl.TryGetValue("TestString" + i.ToString(), out val), "Err_001: Expected TryGetValue to return false");
+ }
+ else
+ {
+ Test.Eval(false, "Err_002: Object at index " + i + " was not collected");
+ }
+ }
+
+ GC.KeepAlive(tbl);
+ }
+
+
+ /*
+ * Ensure that a key whose value has a reference to the key or a reference to another object
+ * which has a reference to the key, gets automatically removed from the dictionary after GC
+ * happens (provided there are no references to the value outside the dictionary.)
+ * Also make sure the value gets gc’d as well.
+ *
+ * In this case we pass the same string array to the function, so keys and values have references to each other
+ * (But only within the dictionary)
+ * */
+
+ public static void TestKeyWithInsideReferences_Pass1(int length)
+ {
+
+ tbl = new ConditionalWeakTable<string,string>();
+
+ weakRefKeyArr = new WeakReference[length];
+ weakRefValArr = new WeakReference[length];
+
+ for (int i = 0; i < length; i++)
+ {
+ String key = "SomeTestString" + i.ToString();
+ String value = key;
+ tbl.Add(key, value);
+
+ // create a weak reference for the key
+ weakRefKeyArr[i] = new WeakReference(key, true);
+ weakRefValArr[i] = new WeakReference(value, true);
+ }
+ }
+
+ public static void TestKeyWithInsideReferences_Pass2(int length)
+ {
+ // force GC to happen
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ GC.Collect();
+
+
+ // note, this assignment will prevent the object from being collected if it isn’t already
+ for (int i = 0; i < length; i++)
+ {
+ Object targetKey = weakRefKeyArr[i].Target;
+ Object targetVal = weakRefValArr[i].Target;
+
+ if (targetKey == null && targetVal == null)
+ {
+ Console.WriteLine("Object at index " + i + " was collected");
+
+ string val;
+
+ // the key should no longer be in the table
+ Test.Eval(!tbl.TryGetValue("SomeTestString" + i.ToString(), out val), "Err_003: Expected TryGetValue to return false");
+ }
+ else
+ {
+ Test.Eval(false, "Err_004: Object at index " + i + " was not collected");
+ }
+ }
+
+ GC.KeepAlive(tbl);
+ }
+
+ /*
+ * Ensure that a key whose value is referenced outside the dictionary does not get
+ * automatically removed from the dictionary after GC happens and the key doesn't get gc'd.
+ */
+ public static void TestKeyWithOutsideReferences_Pass1(int length)
+ {
+ tbl = new ConditionalWeakTable<string, string>();
+
+ weakRefKeyArr = new WeakReference[length];
+ weakRefValArr = new WeakReference[length];
+
+ for (int i = 0; i < length; i++)
+ {
+ String key = "OtherKeyTestString" + i.ToString();
+ String value = "OtherValueTestString" + i.ToString();;
+ tbl.Add(key, value);
+
+
+ // these assignments should prevent the object from being collected
+ if (i == 0)
+ {
+ key0 = key;
+ value0 = value;
+ }
+
+ if (i == 21)
+ {
+ key21 = key;
+ value21 = value;
+ }
+
+ if (i == 99)
+ {
+ key99 = key;
+ value99 = value;
+ }
+
+ // create a weak reference for the key
+ weakRefKeyArr[i] = new WeakReference(key, true);
+ weakRefValArr[i] = new WeakReference(value, true);
+ }
+ }
+
+ public static void TestKeyWithOutsideReferences_Pass2(int length)
+ {
+ // force GC to happen
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ GC.Collect();
+
+ // check that all other objects were collected except for the 3 above
+
+ // note, this assignment will prevent the object from being collected if it isn’t already
+ for (int i = 0; i < length; i++)
+ {
+ Object targetKey = weakRefKeyArr[i].Target;
+ Object targetVal = weakRefValArr[i].Target;
+
+ if (targetKey == null && targetVal == null)
+ {
+ if (i == 0 || i == 21 || i == 99)
+ {
+ // these items shouldn't have been collected
+ Test.Eval(false, "Err_005: Object at index " + i + " was collected");
+ }
+ else
+ {
+ Console.WriteLine("Pass: Object at index " + i + " was collected");
+ Test.Eval(true);
+ }
+ }
+ else
+ {
+ if (i == 0 || i == 21 || i == 99)
+ {
+ Console.WriteLine("Pass: Object at index " + i + " was not collected");
+ Test.Eval(true);
+ }
+ else
+ {
+ // these items should have been collected
+ Test.Eval(false, "Err_006: Object at index " + i + " was not collected");
+ }
+ }
+ }
+
+ // check that the 3 values above were not removed from the dictionary
+ string val;
+
+ Test.Eval(tbl.TryGetValue(key0, out val), "Err_007: Expected TryGetValue to return true");
+ Test.Eval(val == value0, "Err_008: The value returned by TryGetValue doesn't match the expected value");
+
+ Test.Eval(tbl.TryGetValue(key21, out val), "Err_009: Expected TryGetValue to return true");
+ Test.Eval(val == value21, "Err_010: The value returned by TryGetValue doesn't match the expected value");
+
+ Test.Eval(tbl.TryGetValue(key99, out val), "Err_011: Expected TryGetValue to return true");
+ Test.Eval(val == value99, "Err_012: The value returned by TryGetValue doesn't match the expected value");
+
+ GC.KeepAlive(tbl);
+ }
+
+ public static int Main()
+ {
+ try
+ {
+ // Changing this test to 2 passes - the code has been refactored so there are no
+ // outstanding locals with original references to the keys.
+ // This test was failing on IA64 because of IA64 JIT or GC reporting locals longer than necessary
+ // and the entires weren't getting reclaimed.
+
+ Console.WriteLine("\nTest keys with inside references");
+ TestKeyWithInsideReferences_Pass1(100);
+ TestKeyWithInsideReferences_Pass2(100);
+
+
+ Console.WriteLine("\nTest keys with no references");
+ TestKeyWithNoReferences_Pass1(50);
+ TestKeyWithNoReferences_Pass2(50);
+
+
+ Console.WriteLine("\nTest keys with outside references");
+ TestKeyWithOutsideReferences_Pass1(100);
+ TestKeyWithOutsideReferences_Pass2(100);
+
+
+ if (Test.result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 101;
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Test threw unexpected exception:\n{0}", e);
+ return 102;
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/compilerservices/dynamicobjectproperties/testoverrides.cs b/tests/src/baseservices/compilerservices/dynamicobjectproperties/testoverrides.cs
new file mode 100644
index 0000000000..01e3c503c5
--- /dev/null
+++ b/tests/src/baseservices/compilerservices/dynamicobjectproperties/testoverrides.cs
@@ -0,0 +1,93 @@
+// 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.Runtime.CompilerServices;
+
+public class AKey
+{
+ public override int GetHashCode()
+ {
+ Test.Eval(false, "Err_001 AKey.GetHashCode was invoked");
+ return -1;
+ }
+
+ public override bool Equals(Object obj)
+ {
+ Test.Eval(false, "Err_002 AKey.Equals was invoked");
+
+ AKey good = obj as AKey;
+ if (obj == null)
+ return false;
+
+ return this == good;
+ }
+
+ public static bool operator ==(AKey a, AKey b)
+ {
+ Test.Eval(false, "Err_003 AKey.==operator was invoked");
+
+ return (a == b);
+ }
+
+ public static bool operator !=(AKey a, AKey b)
+ {
+ Test.Eval(false, "Err_004 AKey.!=operator was invoked");
+
+ return !(a == b);
+ }
+}
+
+public class TestOverridesClass
+{
+ // this test ensures that while manipulating keys (through add/remove/lookup
+ // in the dictionary the overriden GetHashCode(), Equals(), and ==operator do not get invoked.
+ // Earlier implementation was using these functions virtually so overriding them would result in
+ // the overridden functions being invoked. But later on Ati changed implementation to use
+ // Runtime.GetHashCode and Object.ReferenceEquals so this test makes sure that overridden functions never get invoked.
+ public static void TestOverrides()
+ {
+ string[] stringArr = new string[50];
+ for (int i = 0; i < 50; i++)
+ {
+ stringArr[i] = "SomeTestString" + i.ToString();
+ }
+
+ ConditionalWeakTable<string, string> tbl = new ConditionalWeakTable<string, string>();
+
+ string str;
+
+ for (int i = 0; i < stringArr.Length; i++)
+ {
+ tbl.Add(stringArr[i], stringArr[i]);
+
+ tbl.TryGetValue(stringArr[i], out str);
+
+ tbl.Remove(stringArr[i]);
+ }
+ }
+
+ public static int Main()
+ {
+ try
+ {
+ TestOverrides();
+
+ if (Test.result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 101;
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Test threw unexpected exception:\n{0}", e);
+ return 102;
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/AccessViolationException/AVException01.cs b/tests/src/baseservices/exceptions/AccessViolationException/AVException01.cs
new file mode 100644
index 0000000000..cc94cd0ea2
--- /dev/null
+++ b/tests/src/baseservices/exceptions/AccessViolationException/AVException01.cs
@@ -0,0 +1,35 @@
+// 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;
+
+public class test
+{
+ private object _state = null;
+ private static test _obj = null;
+
+ public static int Main()
+ {
+ int ret = 0;
+ try
+ {
+ try
+ {
+ Object text = _obj._state;
+ }
+ catch (NullReferenceException)
+ {
+ ret = 100;
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Invalid read = {0} (should be NullRef)",ex.GetType());
+ ret = 10;
+ }
+ Console.WriteLine(100 == ret ? "Test Passed" : "Test Failed");
+ return ret;
+ }
+}
+
diff --git a/tests/src/baseservices/exceptions/AccessViolationException/AVException01.csproj b/tests/src/baseservices/exceptions/AccessViolationException/AVException01.csproj
new file mode 100644
index 0000000000..4e71db2512
--- /dev/null
+++ b/tests/src/baseservices/exceptions/AccessViolationException/AVException01.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AVException01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/AccessViolationException/AVException02.cs b/tests/src/baseservices/exceptions/AccessViolationException/AVException02.cs
new file mode 100644
index 0000000000..92ccf1d397
--- /dev/null
+++ b/tests/src/baseservices/exceptions/AccessViolationException/AVException02.cs
@@ -0,0 +1,36 @@
+// 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;
+public class test
+{
+#pragma warning disable 414
+ private object _state = null;
+#pragma warning restore 414
+ private static test _obj = null;
+
+ public static int Main()
+ {
+ int ret = 0;
+ try
+ {
+ try
+ {
+
+ _obj._state = null;
+
+ }
+ catch (NullReferenceException)
+ {
+ ret = 100;
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Invalid write (assigning null) = {0} (should be NullRef)",ex.GetType());
+ ret = 10;
+ }
+ Console.WriteLine(100 == ret ? "Test Passed" : "Test Failed");
+ return ret;
+ }
+}
diff --git a/tests/src/baseservices/exceptions/AccessViolationException/AVException02.csproj b/tests/src/baseservices/exceptions/AccessViolationException/AVException02.csproj
new file mode 100644
index 0000000000..4e71db2512
--- /dev/null
+++ b/tests/src/baseservices/exceptions/AccessViolationException/AVException02.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AVException01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/AccessViolationException/AVException03.cs b/tests/src/baseservices/exceptions/AccessViolationException/AVException03.cs
new file mode 100644
index 0000000000..6b5841a8ad
--- /dev/null
+++ b/tests/src/baseservices/exceptions/AccessViolationException/AVException03.cs
@@ -0,0 +1,35 @@
+// 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;
+
+public class test
+{
+ private object _state = null;
+ private static test _obj = null;
+
+ public static int Main()
+ {
+ int ret = 0;
+ Object temp = new Object();
+ try
+ {
+ try
+ {
+ _obj._state = temp;
+ }
+ catch (NullReferenceException)
+ {
+ ret = 100;
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Invalid write (assigning an object) = {0} (should be NullRef)",ex.GetType());
+ ret = 10;
+ }
+ Console.WriteLine(100 == ret ? "Test Passed" : "Test Failed");
+ return ret;
+ }
+}
diff --git a/tests/src/baseservices/exceptions/AccessViolationException/AVException03.csproj b/tests/src/baseservices/exceptions/AccessViolationException/AVException03.csproj
new file mode 100644
index 0000000000..208109a0bb
--- /dev/null
+++ b/tests/src/baseservices/exceptions/AccessViolationException/AVException03.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AVException03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/StackTracePreserve/StackTracePreserveTests.cs b/tests/src/baseservices/exceptions/StackTracePreserve/StackTracePreserveTests.cs
new file mode 100644
index 0000000000..37b86fe516
--- /dev/null
+++ b/tests/src/baseservices/exceptions/StackTracePreserve/StackTracePreserveTests.cs
@@ -0,0 +1,530 @@
+// 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.Threading;
+using System.Runtime.ExceptionServices;
+using System.IO;
+using System.Security;
+
+class InactiveForeignException
+{
+ private static ExceptionDispatchInfo s_EDI = null;
+ private static int iPassed = 0, iFailed = 0;
+
+ private static Exception GetInnerException()
+ {
+ try
+ {
+ throw new ArgumentNullException("InnerException");
+ }
+ catch (ArgumentNullException ex)
+ {
+ return ex;
+ }
+ }
+
+ private static void ThrowEntryPointInner()
+ {
+ Console.Write("Throwing exception from spawned thread");
+ Console.WriteLine("...");
+ throw new Exception("E1");
+ }
+
+ private static void ThrowEntryPoint()
+ {
+ if (s_EDI == null)
+ {
+ try
+ {
+ ThrowEntryPointInner();
+ }
+ catch(Exception ex)
+ {
+ Console.WriteLine("Caught exception with message: {0}", ex.Message);
+ s_EDI = ExceptionDispatchInfo.Capture(ex);
+ }
+ }
+ else
+ {
+ Console.WriteLine("s_Exception is not null!");
+ s_EDI = null;
+ }
+ }
+
+
+ private static bool Scenario1()
+ {
+ s_EDI = null;
+
+ Console.WriteLine("\nScenario1");
+ Thread t1 = new Thread(new ThreadStart(ThrowEntryPoint));
+ t1.Start();
+ t1.Join();
+
+ bool fPassed = false;
+ if (s_EDI == null)
+ {
+ Console.WriteLine("s_EDI shouldn't be null!");
+ goto exit;
+ }
+
+ // ThrowAndCatch the exception
+ try
+ {
+ s_EDI.Throw();
+ }
+ catch(Exception ex)
+ {
+ string stackTrace = ex.StackTrace;
+ if (stackTrace.IndexOf("ThrowEntryPoint") == -1)
+ {
+ Console.WriteLine("FAILED - unable to find expected stackTrace");
+ }
+ else
+ {
+ Console.WriteLine("Caught: {0}", ex.ToString());
+ Console.WriteLine("Passed");
+ fPassed = true;
+ }
+ }
+exit:
+ Console.WriteLine("");
+ return fPassed;
+ }
+
+ private static void Scenario2Helper()
+ {
+ try
+ {
+ s_EDI.Throw();
+ }
+ catch(Exception)
+ {
+ Console.WriteLine("Rethrowing caught exception..");
+ throw;
+ }
+ }
+
+
+ private static bool Scenario2(bool fShouldLetGoUnhandled)
+ {
+ s_EDI = null;
+
+ Console.WriteLine("\nScenario2");
+ Thread t1 = new Thread(new ThreadStart(ThrowEntryPoint));
+ t1.Start();
+ t1.Join();
+
+ bool fPassed = false;
+ if (s_EDI == null)
+ {
+ Console.WriteLine("s_EDI shouldn't be null!");
+ goto exit;
+ }
+
+ if (!fShouldLetGoUnhandled)
+ {
+ // ThrowRethrowAndCatch the exception
+ try
+ {
+ Scenario2Helper();
+ }
+ catch(Exception ex)
+ {
+ string stackTrace = ex.StackTrace;
+ if ((stackTrace.IndexOf("ThrowEntryPoint") == -1) ||
+ (stackTrace.IndexOf("Scenario2Helper") == -1))
+ {
+ Console.WriteLine("FAILED - unable to find expected stackTrace");
+ }
+ else
+ {
+ Console.WriteLine("Caught: {0}", ex.ToString());
+ Console.WriteLine("Passed");
+ fPassed = true;
+ }
+ }
+ }
+ else
+ {
+ // ThrowRethrowAndUnhandled exception
+ Scenario2Helper();
+ }
+exit:
+ Console.WriteLine("");
+ return fPassed;
+ }
+
+ private static void Scenario3Helper()
+ {
+ ExceptionDispatchInfo edi = null;
+
+ try
+ {
+ Scenario2Helper();
+ }
+ catch (Exception exInner)
+ {
+ Console.WriteLine("Creating new ExceptionDispatchInfo in Scenario3Helper...");
+ edi = ExceptionDispatchInfo.Capture(exInner);
+ }
+
+ edi.Throw();
+ }
+
+ private static bool Scenario3()
+ {
+ s_EDI = null;
+
+ Console.WriteLine("\nScenario3");
+ Thread t1 = new Thread(new ThreadStart(ThrowEntryPoint2));
+ t1.Start();
+ t1.Join();
+
+ bool fPassed = false;
+ if (s_EDI == null)
+ {
+ Console.WriteLine("s_EDI shouldn't be null!");
+ goto exit;
+ }
+
+ // ThrowRethrowCatchCreateNewEDIAndThrow the exception - for multiple preservations
+ try
+ {
+ Scenario3Helper();
+ }
+ catch (Exception ex)
+ {
+ string stackTrace = ex.StackTrace;
+ if ((stackTrace.IndexOf("ThrowEntryPoint") == -1) ||
+ (stackTrace.IndexOf("Scenario2Helper") == -1) ||
+ (stackTrace.IndexOf("Scenario3Helper") == -1))
+ {
+ Console.WriteLine("FAILED - unable to find expected stackTrace");
+ }
+ else
+ {
+ Console.WriteLine("Caught: {0}", ex.ToString());
+ Console.WriteLine("Passed");
+ fPassed = true;
+ }
+ }
+ exit:
+ Console.WriteLine("");
+ return fPassed;
+ }
+
+ private static void ThrowEntryPointNestedHelper()
+ {
+ if (s_EDI == null)
+ {
+ try
+ {
+ ThrowEntryPointInner();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Caught exception with message: {0}", ex.Message);
+ s_EDI = ExceptionDispatchInfo.Capture(ex);
+ }
+
+ // This will preserve the original throw stacktrace and
+ // commence a new one.
+ s_EDI.Throw();
+ }
+ else
+ {
+ Console.WriteLine("s_Exception is not null!");
+ s_EDI = null;
+ }
+ }
+
+ private static void ThrowEntryPoint2()
+ {
+ if (s_EDI == null)
+ {
+ try
+ {
+ ThrowEntryPointNestedHelper();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Caught: {0}", ex.ToString());
+ }
+ }
+ else
+ {
+ Console.WriteLine("s_Exception is not null!");
+ s_EDI = null;
+ }
+ }
+
+
+ private static bool Scenario4()
+ {
+ s_EDI = null;
+
+ Console.WriteLine("\nScenario4");
+ Thread t1 = new Thread(new ThreadStart(ThrowEntryPoint2));
+ t1.Start();
+ t1.Join();
+
+ bool fPassed = false;
+ if (s_EDI == null)
+ {
+ Console.WriteLine("s_EDI shouldn't be null!");
+ goto exit;
+ }
+
+ // ThrowCatchCreateEDI_ThrowEDICatch the exception on T1
+ // ThrowEDI on T2.
+ //
+ // We shouldn't see frames post ThrowEDI on T1 when we ThrowEDI on T2.
+ try
+ {
+ s_EDI.Throw();
+ }
+ catch (Exception ex)
+ {
+ string stackTrace = ex.StackTrace;
+ if ((stackTrace.IndexOf("ThrowEntryPointNestedHelper") == -1) ||
+ (stackTrace.IndexOf("Scenario4") == -1) ||
+ (stackTrace.IndexOf("ThrowEntryPoint2") != -1))
+
+ {
+ Console.WriteLine("FAILED - unable to find expected stackTrace");
+ }
+ else
+ {
+ Console.WriteLine("Caught: {0}", ex.ToString());
+ Console.WriteLine("Passed");
+ fPassed = true;
+ }
+ }
+ exit:
+ Console.WriteLine("");
+ return fPassed;
+ }
+
+
+ // Use EDI to throw exception during EH dispatch on the same
+ // thread for the same exception instance.
+ private static bool Scenario5()
+ {
+ bool fPassed = false;
+ ExceptionDispatchInfo edi = null;
+
+ Console.WriteLine("\nScenario5");
+
+ try
+ {
+ try
+ {
+ ThrowEntryPointInner();
+ }
+ catch(Exception ex)
+ {
+ edi = ExceptionDispatchInfo.Capture(ex);
+ edi.Throw();
+ }
+ }
+ catch(Exception exOuter)
+ {
+ string stackTrace = exOuter.StackTrace;
+ if ((stackTrace.IndexOf("ThrowEntryPointInner") == -1) ||
+ (stackTrace.IndexOf("Scenario5") == -1))
+
+ {
+ Console.WriteLine("FAILED - unable to find expected stackTrace");
+ }
+ else
+ {
+ Console.WriteLine("Caught: {0}", exOuter.ToString());
+ Console.WriteLine("Passed");
+ fPassed = true;
+ }
+ }
+
+ return fPassed;
+ }
+
+ // Use EDI to throw an unthrown exception.
+ private static bool Scenario6()
+ {
+ bool fPassed = false;
+ ExceptionDispatchInfo edi = null;
+
+ Console.WriteLine("\nScenario6");
+
+ try
+ {
+ edi = ExceptionDispatchInfo.Capture(new Exception("Unthrown exception"));
+ edi.Throw();
+ }
+ catch(Exception exOuter)
+ {
+ string stackTrace = exOuter.StackTrace;
+ if ((stackTrace.IndexOf("Scenario6") == -1))
+
+ {
+ Console.WriteLine("FAILED - unable to find expected stackTrace");
+ }
+ else
+ {
+ Console.WriteLine("Caught: {0}", exOuter.ToString());
+ Console.WriteLine("Passed");
+ fPassed = true;
+ }
+ }
+
+ return fPassed;
+ }
+
+ // Scenario 7 - Attempt to create EDI using a null reference throws
+ // ArgumentNullException.
+ private static bool Scenario7()
+ {
+ bool fPassed = false;
+ Console.WriteLine("\nScenario7");
+
+ try{
+ try{
+ ExceptionDispatchInfo edi = ExceptionDispatchInfo.Capture(null);
+ }
+ catch(ArgumentNullException)
+ {
+ fPassed = true;
+ }
+ }
+ catch(Exception)
+ {
+ }
+
+ Console.WriteLine("{0}", (fPassed)?"Passed":"Failed");
+
+ return fPassed;
+ }
+
+
+ private static void Scenario9HelperInner()
+ {
+ try
+ {
+ Console.WriteLine("Throwing from Scenario9Helper...");
+ s_EDI.Throw();
+ }
+ finally
+ {
+ ;
+ }
+ }
+
+ private static void Scenario9Helper()
+ {
+ try
+ {
+ Scenario9HelperInner();
+ }
+ catch (Exception)
+ {
+ Console.WriteLine("Rethrowing...");
+ throw;
+ }
+ }
+
+ private static bool Scenario9()
+ {
+ s_EDI = null;
+
+ Console.WriteLine("\nScenario9");
+ Thread t1 = new Thread(new ThreadStart(ThrowEntryPoint));
+ t1.Start();
+ t1.Join();
+
+ bool fPassed = false;
+ if (s_EDI == null)
+ {
+ Console.WriteLine("s_EDI shouldn't be null!");
+ goto exit;
+ }
+
+ string s1 = null, s2 = null;
+ try
+ {
+ Scenario9Helper();
+ }
+ catch (Exception ex)
+ {
+ s1 = ex.ToString();
+ }
+
+ try
+ {
+ Console.WriteLine("Triggering 2nd Throw...");
+ s_EDI.Throw();
+ }
+ catch (Exception ex)
+ {
+ s2 = ex.ToString();
+ }
+
+ // S1 should have Scenario9HelperInner, Scenario9Helper and Scenario9 frames, in addition to the original frames.
+ // S2 should have Scenario9 frame, in addition to the original frames.
+ if ((s1.IndexOf("Scenario9HelperInner") == -1) || (s1.IndexOf("Scenario9Helper") == -1) ||
+ (s2.IndexOf("Scenario9HelperInner") != -1) || (s2.IndexOf("Scenario9Helper") != -1))
+ {
+ Console.WriteLine("S1: {0}\n", s1);
+ Console.WriteLine("S2: {0}", s2);
+ Console.WriteLine("FAILED");
+
+ }
+ else
+ {
+ Console.WriteLine("S1: {0}\n", s1);
+ Console.WriteLine("S2: {0}", s2);
+ Console.WriteLine("Passed");
+ fPassed = true;
+ }
+
+ exit:
+ Console.WriteLine("");
+ return fPassed;
+ }
+
+ private static void ProcessStatus(bool fPassed)
+ {
+ if (fPassed)
+ iPassed++;
+ else
+ iFailed++;
+
+ }
+
+
+ public static int Main(string[] args)
+ {
+ iPassed = iFailed = 0;
+
+
+ ProcessStatus(Scenario1());
+ ProcessStatus(Scenario2(false));
+ ProcessStatus(Scenario3());
+ ProcessStatus(Scenario4());
+ ProcessStatus(Scenario5());
+ ProcessStatus(Scenario6());
+ ProcessStatus(Scenario7());
+ ProcessStatus(Scenario9());
+
+
+
+ // This is the unhandled exception case
+ //ProcessStatus(Scenario2(true));
+
+
+ Console.WriteLine("\nPassed: {0}\nFailed: {1}", iPassed, iFailed);
+
+ return ((iFailed == 0) && (iPassed > 0))?100:99;
+
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/StackTracePreserve/StackTracePreserveTests.csproj b/tests/src/baseservices/exceptions/StackTracePreserve/StackTracePreserveTests.csproj
new file mode 100644
index 0000000000..84ad30fdf8
--- /dev/null
+++ b/tests/src/baseservices/exceptions/StackTracePreserve/StackTracePreserveTests.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="StackTracePreserveTests.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/GenericExceptions.cs b/tests/src/baseservices/exceptions/generics/GenericExceptions.cs
new file mode 100644
index 0000000000..371732d09d
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/GenericExceptions.cs
@@ -0,0 +1,334 @@
+// 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.Globalization;
+using System.IO;
+
+class MyException : Exception
+{
+}
+
+public class Help
+{
+ public static Exception s_exceptionToThrow;
+ public static bool s_matchingException;
+
+ public static Object s_object = new object();
+}
+
+public class A<T> where T : Exception
+{
+
+ public void InstanceFunctionWithFewArgs()
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (T match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch(Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+
+ public void InstanceFunctionWithManyArgs(int i, int j, int k, object o)
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (T match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch(Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+
+ public static void StaticFunctionWithFewArgs()
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (T match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch(Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ } }
+
+ public static void StaticFunctionWithManyArgs(int i, int j, int k, object o)
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (T match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch(Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+
+ public static void GenericFunctionWithFewArgs<X>() where X : Exception
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (X match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch(Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+
+ public static void GenericFunctionWithManyArgs<X>(int i, int j, int k, object o) where X : Exception
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (X match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch(Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+}
+
+public struct Struct<T> where T : Exception
+{
+
+ public void StructInstanceFunctionWithFewArgs()
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (T match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch(Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+
+ public void StructInstanceFunctionWithManyArgs(int i, int j, int k, object o)
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (T match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch(Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+}
+
+public class GenericExceptions
+{
+ public static void InstanceFunctionWithFewArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ (new A<Exception>()).InstanceFunctionWithFewArgs();
+ (new A<MyException>()).InstanceFunctionWithFewArgs();
+
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ (new A<MyException>()).InstanceFunctionWithFewArgs();
+ }
+
+ public static void InstanceFunctionWithManyArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ (new A<Exception>()).InstanceFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ (new A<MyException>()).InstanceFunctionWithManyArgs(1, 2, 3, Help.s_object);
+
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ (new A<MyException>()).InstanceFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ }
+
+ public static void StaticFunctionWithFewArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ A<Exception>.StaticFunctionWithFewArgs();
+ A<MyException>.StaticFunctionWithFewArgs();
+
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ A<MyException>.StaticFunctionWithFewArgs();
+ }
+
+ public static void StaticFunctionWithManyArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ A<Exception>.StaticFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ A<MyException>.StaticFunctionWithManyArgs(1, 2, 3, Help.s_object);
+
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ A<MyException>.StaticFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ }
+
+ public static void GenericFunctionWithFewArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ A<DivideByZeroException>.GenericFunctionWithFewArgs<Exception>();
+ A<DivideByZeroException>.GenericFunctionWithFewArgs<MyException>();
+
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ A<DivideByZeroException>.GenericFunctionWithFewArgs<MyException>();
+ }
+
+ public static void GenericFunctionWithManyArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ A<DivideByZeroException>.GenericFunctionWithManyArgs<Exception>(1, 2, 3, Help.s_object);
+ A<DivideByZeroException>.GenericFunctionWithManyArgs<MyException>(1, 2, 3, Help.s_object);
+
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ A<DivideByZeroException>.GenericFunctionWithManyArgs<MyException>(1, 2, 3, Help.s_object);
+ }
+
+ public static void StructInstanceFunctionWithFewArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ (new Struct<Exception>()).StructInstanceFunctionWithFewArgs();
+ (new Struct<MyException>()).StructInstanceFunctionWithFewArgs();
+
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ (new Struct<MyException>()).StructInstanceFunctionWithFewArgs();
+ }
+
+ public static void StructInstanceFunctionWithManyArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ (new Struct<Exception>()).StructInstanceFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ (new Struct<MyException>()).StructInstanceFunctionWithManyArgs(1, 2, 3, Help.s_object);
+
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ (new Struct<MyException>()).StructInstanceFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ }
+
+ [System.Runtime.CompilerServices.MethodImpl(
+ System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ public static int Main()
+ {
+ try
+ {
+ Console.WriteLine("This test checks that we can catch generic exceptions.");
+ Console.WriteLine("All exceptions should be handled by the test itself");
+
+ InstanceFunctionWithFewArgs();
+ InstanceFunctionWithManyArgs();
+
+ StaticFunctionWithFewArgs();
+ StaticFunctionWithManyArgs();
+
+ GenericFunctionWithFewArgs();
+ GenericFunctionWithManyArgs();
+
+ StructInstanceFunctionWithFewArgs();
+ StructInstanceFunctionWithManyArgs();
+
+ }
+ catch(Exception)
+ {
+ Console.WriteLine("Test Failed");
+ return -1;
+ }
+
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/GenericExceptions.csproj b/tests/src/baseservices/exceptions/generics/GenericExceptions.csproj
new file mode 100644
index 0000000000..efaabfe9da
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/GenericExceptions.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="genericexceptions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/GenericExceptions01.csproj b/tests/src/baseservices/exceptions/generics/GenericExceptions01.csproj
new file mode 100644
index 0000000000..db7a774779
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/GenericExceptions01.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="genericexceptions01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/GenericExceptions02.csproj b/tests/src/baseservices/exceptions/generics/GenericExceptions02.csproj
new file mode 100644
index 0000000000..d2c3a4fd1d
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/GenericExceptions02.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="genericexceptions02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/GenericExceptions03.csproj b/tests/src/baseservices/exceptions/generics/GenericExceptions03.csproj
new file mode 100644
index 0000000000..40eb42d341
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/GenericExceptions03.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="genericexceptions03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/GenericExceptions04.csproj b/tests/src/baseservices/exceptions/generics/GenericExceptions04.csproj
new file mode 100644
index 0000000000..8c58ee3d43
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/GenericExceptions04.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="genericexceptions04.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/GenericExceptions05.csproj b/tests/src/baseservices/exceptions/generics/GenericExceptions05.csproj
new file mode 100644
index 0000000000..67206f4061
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/GenericExceptions05.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="genericexceptions05.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/GenericExceptions06.csproj b/tests/src/baseservices/exceptions/generics/GenericExceptions06.csproj
new file mode 100644
index 0000000000..491223cde5
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/GenericExceptions06.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="genericexceptions06.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/GenericExceptions07.csproj b/tests/src/baseservices/exceptions/generics/GenericExceptions07.csproj
new file mode 100644
index 0000000000..744117c20a
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/GenericExceptions07.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="genericexceptions07.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/GenericExceptions08.csproj b/tests/src/baseservices/exceptions/generics/GenericExceptions08.csproj
new file mode 100644
index 0000000000..4da0221749
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/GenericExceptions08.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="genericexceptions08.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter001.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter001.csproj
new file mode 100644
index 0000000000..637077cc5b
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter001.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter001.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter002.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter002.csproj
new file mode 100644
index 0000000000..aceafc7886
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter002.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter002.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter003.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter003.csproj
new file mode 100644
index 0000000000..af46d7c3b6
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter003.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter003.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter004.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter004.csproj
new file mode 100644
index 0000000000..e47f9c6d63
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter004.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter004.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter005.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter005.csproj
new file mode 100644
index 0000000000..7c290a3a86
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter005.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter005.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter006.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter006.csproj
new file mode 100644
index 0000000000..09b30c84ae
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter006.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter006.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter007.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter007.csproj
new file mode 100644
index 0000000000..5aef6481fd
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter007.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter007.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter008.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter008.csproj
new file mode 100644
index 0000000000..64e7f2aef7
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter008.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter008.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter009.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter009.csproj
new file mode 100644
index 0000000000..bd588daeba
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter009.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter009.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter010.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter010.csproj
new file mode 100644
index 0000000000..3497367cce
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter010.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter010.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter011.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter011.csproj
new file mode 100644
index 0000000000..030a92ed6d
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter011.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter011.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter012.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter012.csproj
new file mode 100644
index 0000000000..847a4eccd0
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter012.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter012.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter013.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter013.csproj
new file mode 100644
index 0000000000..3e03e4e995
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter013.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter013.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter014.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter014.csproj
new file mode 100644
index 0000000000..4c1ff8ce0d
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter014.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter014.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter015.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter015.csproj
new file mode 100644
index 0000000000..ac5fc7d745
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter015.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter015.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter016.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter016.csproj
new file mode 100644
index 0000000000..73783543f3
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter016.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter016.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter017.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter017.csproj
new file mode 100644
index 0000000000..3510c6a750
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter017.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter017.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/TypeParameter018.csproj b/tests/src/baseservices/exceptions/generics/TypeParameter018.csproj
new file mode 100644
index 0000000000..20181197e0
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/TypeParameter018.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="typeparameter018.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/genericexceptions01.cs b/tests/src/baseservices/exceptions/generics/genericexceptions01.cs
new file mode 100644
index 0000000000..0c046ba963
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/genericexceptions01.cs
@@ -0,0 +1,75 @@
+// 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.Globalization;
+using System.IO;
+
+class MyException : Exception
+{
+}
+
+public class Help
+{
+ public static Exception s_exceptionToThrow;
+ public static bool s_matchingException;
+
+ public static Object s_object = new object();
+}
+
+public class A<T> where T : Exception
+{
+
+ public void InstanceFunctionWithFewArgs()
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (T match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch(Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+}
+
+public class GenericExceptions
+{
+ public static void InstanceFunctionWithFewArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ (new A<Exception>()).InstanceFunctionWithFewArgs();
+ (new A<MyException>()).InstanceFunctionWithFewArgs();
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ (new A<MyException>()).InstanceFunctionWithFewArgs();
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ public static int Main()
+ {
+ try
+ {
+ Console.WriteLine("This test checks that we can catch generic exceptions.");
+ Console.WriteLine("All exceptions should be handled by the test itself");
+ InstanceFunctionWithFewArgs();
+ }
+ catch (Exception)
+ {
+ Console.WriteLine("Test Failed");
+ return -1;
+ }
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+}
diff --git a/tests/src/baseservices/exceptions/generics/genericexceptions02.cs b/tests/src/baseservices/exceptions/generics/genericexceptions02.cs
new file mode 100644
index 0000000000..478c322115
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/genericexceptions02.cs
@@ -0,0 +1,73 @@
+// 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.Globalization;
+using System.IO;
+
+class MyException : Exception
+{
+}
+
+public class Help
+{
+ public static Exception s_exceptionToThrow;
+ public static bool s_matchingException;
+
+ public static Object s_object = new object();
+}
+
+public class A<T> where T : Exception
+{
+ public void InstanceFunctionWithManyArgs(int i, int j, int k, object o)
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (T match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch(Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+}
+public class GenericExceptions
+{
+ public static void InstanceFunctionWithManyArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ (new A<Exception>()).InstanceFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ (new A<MyException>()).InstanceFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ (new A<MyException>()).InstanceFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ public static int Main()
+ {
+ try
+ {
+ Console.WriteLine("This test checks that we can catch generic exceptions.");
+ Console.WriteLine("All exceptions should be handled by the test itself");
+ InstanceFunctionWithManyArgs();
+ }
+ catch (Exception)
+ {
+ Console.WriteLine("Test Failed");
+ return -1;
+ }
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+}
diff --git a/tests/src/baseservices/exceptions/generics/genericexceptions03.cs b/tests/src/baseservices/exceptions/generics/genericexceptions03.cs
new file mode 100644
index 0000000000..9bab488351
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/genericexceptions03.cs
@@ -0,0 +1,84 @@
+// 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.Globalization;
+using System.IO;
+
+class MyException : Exception
+{
+}
+
+public class Help
+{
+ public static Exception s_exceptionToThrow;
+ public static bool s_matchingException;
+
+ public static Object s_object = new object();
+}
+public class A<T>
+where T: Exception
+{
+ public static void StaticFunctionWithFewArgs()
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (T match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch (Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+}
+
+
+public class GenericExceptions
+{
+
+ public static void StaticFunctionWithFewArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ A<Exception>.StaticFunctionWithFewArgs();
+ A<MyException>.StaticFunctionWithFewArgs();
+
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ A<MyException>.StaticFunctionWithFewArgs();
+ }
+
+
+ [System.Runtime.CompilerServices.MethodImpl(
+ System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ public static int Main()
+ {
+ try
+ {
+ Console.WriteLine("This test checks that we can catch generic exceptions.");
+ Console.WriteLine("All exceptions should be handled by the test itself");
+
+ StaticFunctionWithFewArgs();
+
+ }
+ catch(Exception)
+ {
+ Console.WriteLine("Test Failed");
+ return -1;
+ }
+
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/genericexceptions04.cs b/tests/src/baseservices/exceptions/generics/genericexceptions04.cs
new file mode 100644
index 0000000000..f4204d4d50
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/genericexceptions04.cs
@@ -0,0 +1,73 @@
+// 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.Globalization;
+using System.IO;
+
+class MyException : Exception
+{
+}
+
+public class Help
+{
+ public static Exception s_exceptionToThrow;
+ public static bool s_matchingException;
+
+ public static Object s_object = new object();
+}
+public class A<T>
+where T: Exception
+{
+ public static void StaticFunctionWithManyArgs(int i, int j, int k, object o)
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (T match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch (Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+}
+public class GenericExceptions
+{
+ public static void StaticFunctionWithManyArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ A<Exception>.StaticFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ A<MyException>.StaticFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ A<MyException>.StaticFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ public static int Main()
+ {
+ try
+ {
+ Console.WriteLine("This test checks that we can catch generic exceptions.");
+ Console.WriteLine("All exceptions should be handled by the test itself");
+ StaticFunctionWithManyArgs();
+ }
+ catch (Exception)
+ {
+ Console.WriteLine("Test Failed");
+ return -1;
+ }
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+}
diff --git a/tests/src/baseservices/exceptions/generics/genericexceptions05.cs b/tests/src/baseservices/exceptions/generics/genericexceptions05.cs
new file mode 100644
index 0000000000..cb4e90a1a8
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/genericexceptions05.cs
@@ -0,0 +1,74 @@
+// 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.Globalization;
+using System.IO;
+
+class MyException : Exception
+{
+}
+
+public class Help
+{
+ public static Exception s_exceptionToThrow;
+ public static bool s_matchingException;
+
+ public static Object s_object = new object();
+}
+public class A<T>
+where T: Exception
+{
+ public static void GenericFunctionWithFewArgs<X>()
+ where X: Exception
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (X match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch (Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+}
+public class GenericExceptions
+{
+ public static void GenericFunctionWithFewArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ A<DivideByZeroException>.GenericFunctionWithFewArgs<Exception>();
+ A<DivideByZeroException>.GenericFunctionWithFewArgs<MyException>();
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ A<DivideByZeroException>.GenericFunctionWithFewArgs<MyException>();
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ public static int Main()
+ {
+ try
+ {
+ Console.WriteLine("This test checks that we can catch generic exceptions.");
+ Console.WriteLine("All exceptions should be handled by the test itself");
+ GenericFunctionWithFewArgs();
+ }
+ catch (Exception)
+ {
+ Console.WriteLine("Test Failed");
+ return -1;
+ }
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+}
diff --git a/tests/src/baseservices/exceptions/generics/genericexceptions06.cs b/tests/src/baseservices/exceptions/generics/genericexceptions06.cs
new file mode 100644
index 0000000000..b534b231dc
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/genericexceptions06.cs
@@ -0,0 +1,74 @@
+// 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.Globalization;
+using System.IO;
+
+class MyException : Exception
+{
+}
+
+public class Help
+{
+ public static Exception s_exceptionToThrow;
+ public static bool s_matchingException;
+
+ public static Object s_object = new object();
+}
+public class A<T>
+where T: Exception
+{
+ public static void GenericFunctionWithManyArgs<X>(int i, int j, int k, object o)
+ where X: Exception
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (X match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch (Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+}
+public class GenericExceptions
+{
+ public static void GenericFunctionWithManyArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ A<DivideByZeroException>.GenericFunctionWithManyArgs<Exception>(1, 2, 3, Help.s_object);
+ A<DivideByZeroException>.GenericFunctionWithManyArgs<MyException>(1, 2, 3, Help.s_object);
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ A<DivideByZeroException>.GenericFunctionWithManyArgs<MyException>(1, 2, 3, Help.s_object);
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ public static int Main()
+ {
+ try
+ {
+ Console.WriteLine("This test checks that we can catch generic exceptions.");
+ Console.WriteLine("All exceptions should be handled by the test itself");
+ GenericFunctionWithManyArgs();
+ }
+ catch (Exception)
+ {
+ Console.WriteLine("Test Failed");
+ return -1;
+ }
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+}
diff --git a/tests/src/baseservices/exceptions/generics/genericexceptions07.cs b/tests/src/baseservices/exceptions/generics/genericexceptions07.cs
new file mode 100644
index 0000000000..438c3ffc07
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/genericexceptions07.cs
@@ -0,0 +1,73 @@
+// 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.Globalization;
+using System.IO;
+
+class MyException : Exception
+{
+}
+
+public class Help
+{
+ public static Exception s_exceptionToThrow;
+ public static bool s_matchingException;
+
+ public static Object s_object = new object();
+}
+public struct Struct<T>
+where T: Exception
+{
+ public void StructInstanceFunctionWithFewArgs()
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (T match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch (Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+}
+public class GenericExceptions
+{
+ public static void StructInstanceFunctionWithFewArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ (new Struct<Exception>()).StructInstanceFunctionWithFewArgs();
+ (new Struct<MyException>()).StructInstanceFunctionWithFewArgs();
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ (new Struct<MyException>()).StructInstanceFunctionWithFewArgs();
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ public static int Main()
+ {
+ try
+ {
+ Console.WriteLine("This test checks that we can catch generic exceptions.");
+ Console.WriteLine("All exceptions should be handled by the test itself");
+ StructInstanceFunctionWithFewArgs();
+ }
+ catch (Exception)
+ {
+ Console.WriteLine("Test Failed");
+ return -1;
+ }
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+}
diff --git a/tests/src/baseservices/exceptions/generics/genericexceptions08.cs b/tests/src/baseservices/exceptions/generics/genericexceptions08.cs
new file mode 100644
index 0000000000..6511b58d73
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/genericexceptions08.cs
@@ -0,0 +1,73 @@
+// 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.Globalization;
+using System.IO;
+
+class MyException : Exception
+{
+}
+
+public class Help
+{
+ public static Exception s_exceptionToThrow;
+ public static bool s_matchingException;
+
+ public static Object s_object = new object();
+}
+public struct Struct<T>
+where T: Exception
+{
+ public void StructInstanceFunctionWithManyArgs(int i, int j, int k, object o)
+ {
+ try
+ {
+ throw Help.s_exceptionToThrow;
+ }
+ catch (T match)
+ {
+ if (!Help.s_matchingException)
+ throw new Exception("This should not have been caught here", match);
+
+ Console.WriteLine("Caught matching " + match.GetType());
+ }
+ catch (Exception mismatch)
+ {
+ if (Help.s_matchingException)
+ throw new Exception("Should have been caught above", mismatch);
+
+ Console.WriteLine("Expected mismatch " + mismatch.GetType());
+ }
+ }
+}
+public class GenericExceptions
+{
+ public static void StructInstanceFunctionWithManyArgs()
+ {
+ Help.s_matchingException = true;
+ Help.s_exceptionToThrow = new MyException();
+ (new Struct<Exception>()).StructInstanceFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ (new Struct<MyException>()).StructInstanceFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ Help.s_matchingException = false;
+ Help.s_exceptionToThrow = new Exception();
+ (new Struct<MyException>()).StructInstanceFunctionWithManyArgs(1, 2, 3, Help.s_object);
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ public static int Main()
+ {
+ try
+ {
+ Console.WriteLine("This test checks that we can catch generic exceptions.");
+ Console.WriteLine("All exceptions should be handled by the test itself");
+ StructInstanceFunctionWithManyArgs();
+ }
+ catch (Exception)
+ {
+ Console.WriteLine("Test Failed");
+ return -1;
+ }
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+}
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch01.cs b/tests/src/baseservices/exceptions/generics/nested-try-catch01.cs
new file mode 100644
index 0000000000..8dab9c627b
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch01.cs
@@ -0,0 +1,153 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void InternalExceptionTest(bool throwException)
+ {
+ try
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<T>);
+ throw;
+ }
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<T>);
+ }
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ InternalExceptionTest(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch01.csproj b/tests/src/baseservices/exceptions/generics/nested-try-catch01.csproj
new file mode 100644
index 0000000000..f66089a54c
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch01.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="nested-try-catch01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch02.cs b/tests/src/baseservices/exceptions/generics/nested-try-catch02.cs
new file mode 100644
index 0000000000..b1065d4576
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch02.cs
@@ -0,0 +1,144 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ catch(GenException<T>)
+ {
+ Test.Eval(throwException);
+ throw;
+ }
+ }
+ catch(GenException<T>)
+ {
+ Test.Eval(throwException);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch02.csproj b/tests/src/baseservices/exceptions/generics/nested-try-catch02.csproj
new file mode 100644
index 0000000000..b95932c592
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch02.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="nested-try-catch02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch03.cs b/tests/src/baseservices/exceptions/generics/nested-try-catch03.cs
new file mode 100644
index 0000000000..4da2fec0bb
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch03.cs
@@ -0,0 +1,159 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void InternalExceptionTest(bool throwException)
+ {
+ bool set = false;
+ try
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<T>);
+ throw;
+ }
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<T>);
+ }
+ finally
+ {
+ set = true;
+ }
+ Test.Eval(set);
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ InternalExceptionTest(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch03.csproj b/tests/src/baseservices/exceptions/generics/nested-try-catch03.csproj
new file mode 100644
index 0000000000..73353c171f
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch03.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="nested-try-catch03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch04.cs b/tests/src/baseservices/exceptions/generics/nested-try-catch04.cs
new file mode 100644
index 0000000000..55a2e290f5
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch04.cs
@@ -0,0 +1,150 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void ExceptionTest(bool throwException)
+ {
+ bool set = false;
+ try
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ catch(GenException<T>)
+ {
+ Test.Eval(throwException);
+ throw;
+ }
+ }
+ catch(GenException<T>)
+ {
+ Test.Eval(throwException);
+ }
+ finally
+ {
+ set = true;
+ }
+ Test.Eval(set);
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch04.csproj b/tests/src/baseservices/exceptions/generics/nested-try-catch04.csproj
new file mode 100644
index 0000000000..644c6e2571
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch04.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="nested-try-catch04.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch05.cs b/tests/src/baseservices/exceptions/generics/nested-try-catch05.cs
new file mode 100644
index 0000000000..db9d7594d4
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch05.cs
@@ -0,0 +1,164 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public bool hitFinally;
+ public void InternalExceptionTest(bool throwException)
+ {
+ try
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<T>);
+ throw;
+ }
+ }
+ finally
+ {
+ hitFinally = true;
+ }
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ hitFinally = false;
+ InternalExceptionTest(throwException);
+ Test.Eval(!throwException);
+ }
+ catch
+ {
+ Test.Eval(throwException);
+ }
+ Test.Eval(hitFinally);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch05.csproj b/tests/src/baseservices/exceptions/generics/nested-try-catch05.csproj
new file mode 100644
index 0000000000..557afdb1fb
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch05.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="nested-try-catch05.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch06.cs b/tests/src/baseservices/exceptions/generics/nested-try-catch06.cs
new file mode 100644
index 0000000000..0d439d7aba
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch06.cs
@@ -0,0 +1,164 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public bool hitFinally;
+ public void InternalExceptionTest(bool throwException)
+ {
+ try
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(GenException<T>)
+ {
+ Test.Eval(throwException);
+ throw;
+ }
+ }
+ finally
+ {
+ hitFinally = true;
+ }
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ hitFinally = false;
+ InternalExceptionTest(throwException);
+ Test.Eval(!throwException);
+ }
+ catch
+ {
+ Test.Eval(throwException);
+ }
+ Test.Eval(hitFinally);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch06.csproj b/tests/src/baseservices/exceptions/generics/nested-try-catch06.csproj
new file mode 100644
index 0000000000..c6995cc8fd
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch06.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="nested-try-catch06.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch07.cs b/tests/src/baseservices/exceptions/generics/nested-try-catch07.cs
new file mode 100644
index 0000000000..f16a6bcefd
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch07.cs
@@ -0,0 +1,156 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void InternalExceptionTest(bool throwException)
+ {
+ bool set = false;
+ try
+ {
+ if (throwException)
+ throw new Exception();
+ }
+ catch(Exception)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<T>);
+ set = true;
+ }
+ }
+ Test.Eval(throwException ^ (!set));
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ InternalExceptionTest(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch07.csproj b/tests/src/baseservices/exceptions/generics/nested-try-catch07.csproj
new file mode 100644
index 0000000000..01bc92d7ef
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch07.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="nested-try-catch07.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch08.cs b/tests/src/baseservices/exceptions/generics/nested-try-catch08.cs
new file mode 100644
index 0000000000..3a1d8bfc0e
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch08.cs
@@ -0,0 +1,156 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void InternalExceptionTest(bool throwException)
+ {
+ bool set = false;
+ try
+ {
+ if (throwException)
+ throw new Exception();
+ }
+ catch(Exception)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(GenException<T>)
+ {
+ Test.Eval(throwException);
+ set = true;
+ }
+ }
+ Test.Eval(throwException ^ (!set));
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ InternalExceptionTest(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch08.csproj b/tests/src/baseservices/exceptions/generics/nested-try-catch08.csproj
new file mode 100644
index 0000000000..da28169445
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch08.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="nested-try-catch08.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch09.cs b/tests/src/baseservices/exceptions/generics/nested-try-catch09.cs
new file mode 100644
index 0000000000..be34afa809
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch09.cs
@@ -0,0 +1,159 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void InternalExceptionTest(bool throwException)
+ {
+ bool set = false;
+ try
+ {
+ if (throwException)
+ throw new GenException<T>();
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<T>);
+ }
+ finally
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(GenException<T>)
+ {
+ set = true;
+ }
+ }
+ Test.Eval(set);
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ InternalExceptionTest(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch09.csproj b/tests/src/baseservices/exceptions/generics/nested-try-catch09.csproj
new file mode 100644
index 0000000000..a86d05aaf9
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch09.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="nested-try-catch09.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch10.cs b/tests/src/baseservices/exceptions/generics/nested-try-catch10.cs
new file mode 100644
index 0000000000..8ab099e4c3
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch10.cs
@@ -0,0 +1,160 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void InternalExceptionTest(bool throwException)
+ {
+ bool set = false;
+ try
+ {
+ if (throwException)
+ throw new GenException<T>();
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<T>);
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(GenException<T>)
+ {
+ set = true;
+ }
+ }
+ finally
+ {
+ set = true;
+ }
+ Test.Eval(set);
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ InternalExceptionTest(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/nested-try-catch10.csproj b/tests/src/baseservices/exceptions/generics/nested-try-catch10.csproj
new file mode 100644
index 0000000000..46b9b92803
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/nested-try-catch10.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="nested-try-catch10.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-finally-struct01.cs b/tests/src/baseservices/exceptions/generics/try-catch-finally-struct01.cs
new file mode 100644
index 0000000000..b1f1c082e9
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-finally-struct01.cs
@@ -0,0 +1,152 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public struct Gen<T>
+{
+ public void InternalExceptionTest(bool throwException)
+ {
+ string ExceptionClass = typeof(GenException<T>).ToString();
+ bool set = false;
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(Exception E)
+ {
+ set = true;
+ Test.Eval(E is GenException<T>);
+ }
+ finally
+ {
+ Test.Eval(set);
+ }
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ InternalExceptionTest(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-finally-struct01.csproj b/tests/src/baseservices/exceptions/generics/try-catch-finally-struct01.csproj
new file mode 100644
index 0000000000..b06a18048b
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-finally-struct01.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-finally-struct01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-finally-struct02.cs b/tests/src/baseservices/exceptions/generics/try-catch-finally-struct02.cs
new file mode 100644
index 0000000000..f31c73f59b
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-finally-struct02.cs
@@ -0,0 +1,147 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public struct Gen<T>
+{
+ public void ExceptionTest(bool throwException)
+ {
+ bool set = false;
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ catch(GenException<T>)
+ {
+ set = true;
+ Test.Eval(throwException);
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ finally
+ {
+ Test.Eval(set);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-finally-struct02.csproj b/tests/src/baseservices/exceptions/generics/try-catch-finally-struct02.csproj
new file mode 100644
index 0000000000..a8b4f61704
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-finally-struct02.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-finally-struct02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-finally-struct03.cs b/tests/src/baseservices/exceptions/generics/try-catch-finally-struct03.cs
new file mode 100644
index 0000000000..f4b0b892ef
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-finally-struct03.cs
@@ -0,0 +1,148 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void ExceptionTest(bool throwException)
+ {
+ bool set = false;
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ catch(GenException<T>)
+ {
+ Test.Eval(throwException);
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ finally
+ {
+ set = true;
+ Test.Eval(true);
+ }
+ Test.Eval(set);
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(false);
+ new Gen<double>().ExceptionTest(false);
+ new Gen<string>().ExceptionTest(false);
+ new Gen<object>().ExceptionTest(false);
+ new Gen<Guid>().ExceptionTest(false);
+
+ new Gen<int[]>().ExceptionTest(false);
+ new Gen<double[,]>().ExceptionTest(false);
+ new Gen<string[][][]>().ExceptionTest(false);
+ new Gen<object[,,,]>().ExceptionTest(false);
+ new Gen<Guid[][,,,][]>().ExceptionTest(false);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(false);
+ new Gen<RefX1<double>[,]>().ExceptionTest(false);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(false);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(false);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(false);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(false);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(false);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(false);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(false);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(false);
+ new Gen<ValX1<int>[]>().ExceptionTest(false);
+ new Gen<ValX1<double>[,]>().ExceptionTest(false);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(false);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(false);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(false);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(false);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(false);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(false);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(false);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(false);
+
+ new Gen<RefX1<int>>().ExceptionTest(false);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(false);
+ new Gen<RefX2<int,string>>().ExceptionTest(false);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(false);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(false);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(false);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(false);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(false);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(false);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(false);
+
+ new Gen<ValX1<int>>().ExceptionTest(false);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(false);
+ new Gen<ValX2<int,string>>().ExceptionTest(false);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(false);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(false);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(false);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(false);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(false);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(false);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(false);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-finally-struct03.csproj b/tests/src/baseservices/exceptions/generics/try-catch-finally-struct03.csproj
new file mode 100644
index 0000000000..8e3550a160
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-finally-struct03.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-finally-struct03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-finally01.cs b/tests/src/baseservices/exceptions/generics/try-catch-finally01.cs
new file mode 100644
index 0000000000..a1eaa6674c
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-finally01.cs
@@ -0,0 +1,152 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void InternalExceptionTest(bool throwException)
+ {
+ string ExceptionClass = typeof(GenException<T>).ToString();
+ bool set = false;
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(Exception E)
+ {
+ set = true;
+ Test.Eval(E is GenException<T>);
+ }
+ finally
+ {
+ Test.Eval(set);
+ }
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ InternalExceptionTest(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-finally01.csproj b/tests/src/baseservices/exceptions/generics/try-catch-finally01.csproj
new file mode 100644
index 0000000000..55cf157e7e
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-finally01.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-finally01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-finally02.cs b/tests/src/baseservices/exceptions/generics/try-catch-finally02.cs
new file mode 100644
index 0000000000..26376edc7c
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-finally02.cs
@@ -0,0 +1,147 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void ExceptionTest(bool throwException)
+ {
+ bool set = false;
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ catch(GenException<T>)
+ {
+ set = true;
+ Test.Eval(throwException);
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ finally
+ {
+ Test.Eval(set);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-finally02.csproj b/tests/src/baseservices/exceptions/generics/try-catch-finally02.csproj
new file mode 100644
index 0000000000..f72a5d7588
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-finally02.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-finally02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-finally03.cs b/tests/src/baseservices/exceptions/generics/try-catch-finally03.cs
new file mode 100644
index 0000000000..f4b0b892ef
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-finally03.cs
@@ -0,0 +1,148 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void ExceptionTest(bool throwException)
+ {
+ bool set = false;
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ catch(GenException<T>)
+ {
+ Test.Eval(throwException);
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ finally
+ {
+ set = true;
+ Test.Eval(true);
+ }
+ Test.Eval(set);
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(false);
+ new Gen<double>().ExceptionTest(false);
+ new Gen<string>().ExceptionTest(false);
+ new Gen<object>().ExceptionTest(false);
+ new Gen<Guid>().ExceptionTest(false);
+
+ new Gen<int[]>().ExceptionTest(false);
+ new Gen<double[,]>().ExceptionTest(false);
+ new Gen<string[][][]>().ExceptionTest(false);
+ new Gen<object[,,,]>().ExceptionTest(false);
+ new Gen<Guid[][,,,][]>().ExceptionTest(false);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(false);
+ new Gen<RefX1<double>[,]>().ExceptionTest(false);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(false);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(false);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(false);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(false);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(false);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(false);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(false);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(false);
+ new Gen<ValX1<int>[]>().ExceptionTest(false);
+ new Gen<ValX1<double>[,]>().ExceptionTest(false);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(false);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(false);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(false);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(false);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(false);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(false);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(false);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(false);
+
+ new Gen<RefX1<int>>().ExceptionTest(false);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(false);
+ new Gen<RefX2<int,string>>().ExceptionTest(false);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(false);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(false);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(false);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(false);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(false);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(false);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(false);
+
+ new Gen<ValX1<int>>().ExceptionTest(false);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(false);
+ new Gen<ValX2<int,string>>().ExceptionTest(false);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(false);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(false);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(false);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(false);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(false);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(false);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(false);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-finally03.csproj b/tests/src/baseservices/exceptions/generics/try-catch-finally03.csproj
new file mode 100644
index 0000000000..bc9c98de86
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-finally03.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-finally03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct01.cs b/tests/src/baseservices/exceptions/generics/try-catch-struct01.cs
new file mode 100644
index 0000000000..6b74a5cd92
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct01.cs
@@ -0,0 +1,145 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public struct Gen<T>
+{
+ public void InternalExceptionTest(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<T>);
+ }
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ InternalExceptionTest(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct01.csproj b/tests/src/baseservices/exceptions/generics/try-catch-struct01.csproj
new file mode 100644
index 0000000000..0fb376b601
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct01.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-struct01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct02.cs b/tests/src/baseservices/exceptions/generics/try-catch-struct02.cs
new file mode 100644
index 0000000000..303c20e14f
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct02.cs
@@ -0,0 +1,141 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public struct Gen<T>
+{
+ public void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ catch(GenException<T>)
+ {
+ Test.Eval(throwException);
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct02.csproj b/tests/src/baseservices/exceptions/generics/try-catch-struct02.csproj
new file mode 100644
index 0000000000..e8595c9507
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct02.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-struct02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct03.cs b/tests/src/baseservices/exceptions/generics/try-catch-struct03.cs
new file mode 100644
index 0000000000..e1c9cf0a66
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct03.cs
@@ -0,0 +1,155 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public struct Gen<T>
+{
+ public void InternalExceptionTest(bool throwException)
+ {
+ string ExceptionClass = typeof(GenException<T>).ToString();
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(GenException<System.InvalidCastException>)
+ {
+ //this should never bee hit!
+ Test.Eval(false);
+ }
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ InternalExceptionTest(throwException);
+ Test.Eval(!throwException);
+ }
+ catch
+ {
+ Test.Eval(throwException);
+ }
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct03.csproj b/tests/src/baseservices/exceptions/generics/try-catch-struct03.csproj
new file mode 100644
index 0000000000..0f2a4a0738
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct03.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-struct03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct04.cs b/tests/src/baseservices/exceptions/generics/try-catch-struct04.cs
new file mode 100644
index 0000000000..cb98bd6076
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct04.cs
@@ -0,0 +1,145 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public struct Gen<T>
+{
+ public static void InternalExceptionTest(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<T>);
+ }
+ }
+
+ public static void ExceptionTest(bool throwException)
+ {
+ InternalExceptionTest(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ExceptionTest(true);
+ Gen<double>.ExceptionTest(true);
+ Gen<string>.ExceptionTest(true);
+ Gen<object>.ExceptionTest(true);
+ Gen<Guid>.ExceptionTest(true);
+
+ Gen<int[]>.ExceptionTest(true);
+ Gen<double[,]>.ExceptionTest(true);
+ Gen<string[][][]>.ExceptionTest(true);
+ Gen<object[,,,]>.ExceptionTest(true);
+ Gen<Guid[][,,,][]>.ExceptionTest(true);
+
+ Gen<RefX1<int>[]>.ExceptionTest(true);
+ Gen<RefX1<double>[,]>.ExceptionTest(true);
+ Gen<RefX1<string>[][][]>.ExceptionTest(true);
+ Gen<RefX1<object>[,,,]>.ExceptionTest(true);
+ Gen<RefX1<Guid>[][,,,][]>.ExceptionTest(true);
+ Gen<RefX2<int,int>[]>.ExceptionTest(true);
+ Gen<RefX2<double,double>[,]>.ExceptionTest(true);
+ Gen<RefX2<string,string>[][][]>.ExceptionTest(true);
+ Gen<RefX2<object,object>[,,,]>.ExceptionTest(true);
+ Gen<RefX2<Guid,Guid>[][,,,][]>.ExceptionTest(true);
+ Gen<ValX1<int>[]>.ExceptionTest(true);
+ Gen<ValX1<double>[,]>.ExceptionTest(true);
+ Gen<ValX1<string>[][][]>.ExceptionTest(true);
+ Gen<ValX1<object>[,,,]>.ExceptionTest(true);
+ Gen<ValX1<Guid>[][,,,][]>.ExceptionTest(true);
+
+ Gen<ValX2<int,int>[]>.ExceptionTest(true);
+ Gen<ValX2<double,double>[,]>.ExceptionTest(true);
+ Gen<ValX2<string,string>[][][]>.ExceptionTest(true);
+ Gen<ValX2<object,object>[,,,]>.ExceptionTest(true);
+ Gen<ValX2<Guid,Guid>[][,,,][]>.ExceptionTest(true);
+
+ Gen<RefX1<int>>.ExceptionTest(true);
+ Gen<RefX1<ValX1<int>>>.ExceptionTest(true);
+ Gen<RefX2<int,string>>.ExceptionTest(true);
+ Gen<RefX3<int,string,Guid>>.ExceptionTest(true);
+
+ Gen<RefX1<RefX1<int>>>.ExceptionTest(true);
+ Gen<RefX1<RefX1<RefX1<string>>>>.ExceptionTest(true);
+ Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>.ExceptionTest(true);
+
+ Gen<RefX1<RefX2<int,string>>>.ExceptionTest(true);
+ Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>.ExceptionTest(true);
+ Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>.ExceptionTest(true);
+
+ Gen<ValX1<int>>.ExceptionTest(true);
+ Gen<ValX1<RefX1<int>>>.ExceptionTest(true);
+ Gen<ValX2<int,string>>.ExceptionTest(true);
+ Gen<ValX3<int,string,Guid>>.ExceptionTest(true);
+
+ Gen<ValX1<ValX1<int>>>.ExceptionTest(true);
+ Gen<ValX1<ValX1<ValX1<string>>>>.ExceptionTest(true);
+ Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>.ExceptionTest(true);
+
+ Gen<ValX1<ValX2<int,string>>>.ExceptionTest(true);
+ Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>.ExceptionTest(true);
+ Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>.ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct04.csproj b/tests/src/baseservices/exceptions/generics/try-catch-struct04.csproj
new file mode 100644
index 0000000000..5be2c31251
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct04.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-struct04.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct05.cs b/tests/src/baseservices/exceptions/generics/try-catch-struct05.cs
new file mode 100644
index 0000000000..ba05558f90
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct05.cs
@@ -0,0 +1,142 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public struct Gen<T>
+{
+ public static void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ catch(GenException<T>)
+ {
+ Test.Eval(throwException);
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ExceptionTest(true);
+ Gen<double>.ExceptionTest(true);
+ Gen<string>.ExceptionTest(true);
+ Gen<object>.ExceptionTest(true);
+ Gen<Guid>.ExceptionTest(true);
+
+ Gen<int[]>.ExceptionTest(true);
+ Gen<double[,]>.ExceptionTest(true);
+ Gen<string[][][]>.ExceptionTest(true);
+ Gen<object[,,,]>.ExceptionTest(true);
+ Gen<Guid[][,,,][]>.ExceptionTest(true);
+
+ Gen<RefX1<int>[]>.ExceptionTest(true);
+ Gen<RefX1<double>[,]>.ExceptionTest(true);
+ Gen<RefX1<string>[][][]>.ExceptionTest(true);
+ Gen<RefX1<object>[,,,]>.ExceptionTest(true);
+ Gen<RefX1<Guid>[][,,,][]>.ExceptionTest(true);
+ Gen<RefX2<int,int>[]>.ExceptionTest(true);
+ Gen<RefX2<double,double>[,]>.ExceptionTest(true);
+ Gen<RefX2<string,string>[][][]>.ExceptionTest(true);
+ Gen<RefX2<object,object>[,,,]>.ExceptionTest(true);
+ Gen<RefX2<Guid,Guid>[][,,,][]>.ExceptionTest(true);
+ Gen<ValX1<int>[]>.ExceptionTest(true);
+ Gen<ValX1<double>[,]>.ExceptionTest(true);
+ Gen<ValX1<string>[][][]>.ExceptionTest(true);
+ Gen<ValX1<object>[,,,]>.ExceptionTest(true);
+ Gen<ValX1<Guid>[][,,,][]>.ExceptionTest(true);
+
+ Gen<ValX2<int,int>[]>.ExceptionTest(true);
+ Gen<ValX2<double,double>[,]>.ExceptionTest(true);
+ Gen<ValX2<string,string>[][][]>.ExceptionTest(true);
+ Gen<ValX2<object,object>[,,,]>.ExceptionTest(true);
+ Gen<ValX2<Guid,Guid>[][,,,][]>.ExceptionTest(true);
+
+ Gen<RefX1<int>>.ExceptionTest(true);
+ Gen<RefX1<ValX1<int>>>.ExceptionTest(true);
+ Gen<RefX2<int,string>>.ExceptionTest(true);
+ Gen<RefX3<int,string,Guid>>.ExceptionTest(true);
+
+ Gen<RefX1<RefX1<int>>>.ExceptionTest(true);
+ Gen<RefX1<RefX1<RefX1<string>>>>.ExceptionTest(true);
+ Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>.ExceptionTest(true);
+
+ Gen<RefX1<RefX2<int,string>>>.ExceptionTest(true);
+ Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>.ExceptionTest(true);
+ Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>.ExceptionTest(true);
+
+ Gen<ValX1<int>>.ExceptionTest(true);
+ Gen<ValX1<RefX1<int>>>.ExceptionTest(true);
+ Gen<ValX2<int,string>>.ExceptionTest(true);
+ Gen<ValX3<int,string,Guid>>.ExceptionTest(true);
+
+ Gen<ValX1<ValX1<int>>>.ExceptionTest(true);
+ Gen<ValX1<ValX1<ValX1<string>>>>.ExceptionTest(true);
+ Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>.ExceptionTest(true);
+
+ Gen<ValX1<ValX2<int,string>>>.ExceptionTest(true);
+ Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>.ExceptionTest(true);
+ Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>.ExceptionTest(true);
+
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct05.csproj b/tests/src/baseservices/exceptions/generics/try-catch-struct05.csproj
new file mode 100644
index 0000000000..6bf77b81a2
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct05.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-struct05.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct06.cs b/tests/src/baseservices/exceptions/generics/try-catch-struct06.cs
new file mode 100644
index 0000000000..79dcfcb0d5
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct06.cs
@@ -0,0 +1,145 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public struct Gen
+{
+ public void InternalExceptionTest<U>(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<U>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<U>);
+ }
+ }
+
+ public void ExceptionTest<U>(bool throwException)
+ {
+ InternalExceptionTest<U>(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen().ExceptionTest<int>(true);
+ new Gen().ExceptionTest<double>(true);
+ new Gen().ExceptionTest<string>(true);
+ new Gen().ExceptionTest<object>(true);
+ new Gen().ExceptionTest<Guid>(true);
+
+ new Gen().ExceptionTest<int[]>(true);
+ new Gen().ExceptionTest<double[,]>(true);
+ new Gen().ExceptionTest<string[][][]>(true);
+ new Gen().ExceptionTest<object[,,,]>(true);
+ new Gen().ExceptionTest<Guid[][,,,][]>(true);
+
+ new Gen().ExceptionTest<RefX1<int>[]>(true);
+ new Gen().ExceptionTest<RefX1<double>[,]>(true);
+ new Gen().ExceptionTest<RefX1<string>[][][]>(true);
+ new Gen().ExceptionTest<RefX1<object>[,,,]>(true);
+ new Gen().ExceptionTest<RefX1<Guid>[][,,,][]>(true);
+ new Gen().ExceptionTest<RefX2<int,int>[]>(true);
+ new Gen().ExceptionTest<RefX2<double,double>[,]>(true);
+ new Gen().ExceptionTest<RefX2<string,string>[][][]>(true);
+ new Gen().ExceptionTest<RefX2<object,object>[,,,]>(true);
+ new Gen().ExceptionTest<RefX2<Guid,Guid>[][,,,][]>(true);
+ new Gen().ExceptionTest<ValX1<int>[]>(true);
+ new Gen().ExceptionTest<ValX1<double>[,]>(true);
+ new Gen().ExceptionTest<ValX1<string>[][][]>(true);
+ new Gen().ExceptionTest<ValX1<object>[,,,]>(true);
+ new Gen().ExceptionTest<ValX1<Guid>[][,,,][]>(true);
+
+ new Gen().ExceptionTest<ValX2<int,int>[]>(true);
+ new Gen().ExceptionTest<ValX2<double,double>[,]>(true);
+ new Gen().ExceptionTest<ValX2<string,string>[][][]>(true);
+ new Gen().ExceptionTest<ValX2<object,object>[,,,]>(true);
+ new Gen().ExceptionTest<ValX2<Guid,Guid>[][,,,][]>(true);
+
+ new Gen().ExceptionTest<RefX1<int>>(true);
+ new Gen().ExceptionTest<RefX1<ValX1<int>>>(true);
+ new Gen().ExceptionTest<RefX2<int,string>>(true);
+ new Gen().ExceptionTest<RefX3<int,string,Guid>>(true);
+
+ new Gen().ExceptionTest<RefX1<RefX1<int>>>(true);
+ new Gen().ExceptionTest<RefX1<RefX1<RefX1<string>>>>(true);
+ new Gen().ExceptionTest<RefX1<RefX1<RefX1<RefX1<Guid>>>>>(true);
+
+ new Gen().ExceptionTest<RefX1<RefX2<int,string>>>(true);
+ new Gen().ExceptionTest<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>(true);
+ new Gen().ExceptionTest<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+ new Gen().ExceptionTest<ValX1<int>>(true);
+ new Gen().ExceptionTest<ValX1<RefX1<int>>>(true);
+ new Gen().ExceptionTest<ValX2<int,string>>(true);
+ new Gen().ExceptionTest<ValX3<int,string,Guid>>(true);
+
+ new Gen().ExceptionTest<ValX1<ValX1<int>>>(true);
+ new Gen().ExceptionTest<ValX1<ValX1<ValX1<string>>>>(true);
+ new Gen().ExceptionTest<ValX1<ValX1<ValX1<ValX1<Guid>>>>>(true);
+
+ new Gen().ExceptionTest<ValX1<ValX2<int,string>>>(true);
+ new Gen().ExceptionTest<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>(true);
+ new Gen().ExceptionTest<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct06.csproj b/tests/src/baseservices/exceptions/generics/try-catch-struct06.csproj
new file mode 100644
index 0000000000..b57b69d6a7
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct06.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-struct06.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct07.cs b/tests/src/baseservices/exceptions/generics/try-catch-struct07.cs
new file mode 100644
index 0000000000..cc04e051ad
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct07.cs
@@ -0,0 +1,142 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public struct Gen
+{
+ public void ExceptionTest<U>(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<U>();
+ }
+ Test.Eval(!throwException);
+ }
+ catch(GenException<U>)
+ {
+ Test.Eval(throwException);
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen().ExceptionTest<int>(true);
+ new Gen().ExceptionTest<double>(true);
+ new Gen().ExceptionTest<string>(true);
+ new Gen().ExceptionTest<object>(true);
+ new Gen().ExceptionTest<Guid>(true);
+
+ new Gen().ExceptionTest<int[]>(true);
+ new Gen().ExceptionTest<double[,]>(true);
+ new Gen().ExceptionTest<string[][][]>(true);
+ new Gen().ExceptionTest<object[,,,]>(true);
+ new Gen().ExceptionTest<Guid[][,,,][]>(true);
+
+ new Gen().ExceptionTest<RefX1<int>[]>(true);
+ new Gen().ExceptionTest<RefX1<double>[,]>(true);
+ new Gen().ExceptionTest<RefX1<string>[][][]>(true);
+ new Gen().ExceptionTest<RefX1<object>[,,,]>(true);
+ new Gen().ExceptionTest<RefX1<Guid>[][,,,][]>(true);
+ new Gen().ExceptionTest<RefX2<int,int>[]>(true);
+ new Gen().ExceptionTest<RefX2<double,double>[,]>(true);
+ new Gen().ExceptionTest<RefX2<string,string>[][][]>(true);
+ new Gen().ExceptionTest<RefX2<object,object>[,,,]>(true);
+ new Gen().ExceptionTest<RefX2<Guid,Guid>[][,,,][]>(true);
+ new Gen().ExceptionTest<ValX1<int>[]>(true);
+ new Gen().ExceptionTest<ValX1<double>[,]>(true);
+ new Gen().ExceptionTest<ValX1<string>[][][]>(true);
+ new Gen().ExceptionTest<ValX1<object>[,,,]>(true);
+ new Gen().ExceptionTest<ValX1<Guid>[][,,,][]>(true);
+
+ new Gen().ExceptionTest<ValX2<int,int>[]>(true);
+ new Gen().ExceptionTest<ValX2<double,double>[,]>(true);
+ new Gen().ExceptionTest<ValX2<string,string>[][][]>(true);
+ new Gen().ExceptionTest<ValX2<object,object>[,,,]>(true);
+ new Gen().ExceptionTest<ValX2<Guid,Guid>[][,,,][]>(true);
+
+ new Gen().ExceptionTest<RefX1<int>>(true);
+ new Gen().ExceptionTest<RefX1<ValX1<int>>>(true);
+ new Gen().ExceptionTest<RefX2<int,string>>(true);
+ new Gen().ExceptionTest<RefX3<int,string,Guid>>(true);
+
+ new Gen().ExceptionTest<RefX1<RefX1<int>>>(true);
+ new Gen().ExceptionTest<RefX1<RefX1<RefX1<string>>>>(true);
+ new Gen().ExceptionTest<RefX1<RefX1<RefX1<RefX1<Guid>>>>>(true);
+
+ new Gen().ExceptionTest<RefX1<RefX2<int,string>>>(true);
+ new Gen().ExceptionTest<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>(true);
+ new Gen().ExceptionTest<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+ new Gen().ExceptionTest<ValX1<int>>(true);
+ new Gen().ExceptionTest<ValX1<RefX1<int>>>(true);
+ new Gen().ExceptionTest<ValX2<int,string>>(true);
+ new Gen().ExceptionTest<ValX3<int,string,Guid>>(true);
+
+ new Gen().ExceptionTest<ValX1<ValX1<int>>>(true);
+ new Gen().ExceptionTest<ValX1<ValX1<ValX1<string>>>>(true);
+ new Gen().ExceptionTest<ValX1<ValX1<ValX1<ValX1<Guid>>>>>(true);
+
+ new Gen().ExceptionTest<ValX1<ValX2<int,string>>>(true);
+ new Gen().ExceptionTest<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>(true);
+ new Gen().ExceptionTest<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct07.csproj b/tests/src/baseservices/exceptions/generics/try-catch-struct07.csproj
new file mode 100644
index 0000000000..ce2fbf2c09
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct07.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-struct07.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct08.cs b/tests/src/baseservices/exceptions/generics/try-catch-struct08.cs
new file mode 100644
index 0000000000..c22b0dc82e
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct08.cs
@@ -0,0 +1,145 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public struct Gen
+{
+ public static void InternalExceptionTest<U>(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<U>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<U>);
+ }
+ }
+
+ public static void ExceptionTest<U>(bool throwException)
+ {
+ InternalExceptionTest<U>(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ExceptionTest<int>(true);
+ Gen.ExceptionTest<double>(true);
+ Gen.ExceptionTest<string>(true);
+ Gen.ExceptionTest<object>(true);
+ Gen.ExceptionTest<Guid>(true);
+
+ Gen.ExceptionTest<int[]>(true);
+ Gen.ExceptionTest<double[,]>(true);
+ Gen.ExceptionTest<string[][][]>(true);
+ Gen.ExceptionTest<object[,,,]>(true);
+ Gen.ExceptionTest<Guid[][,,,][]>(true);
+
+ Gen.ExceptionTest<RefX1<int>[]>(true);
+ Gen.ExceptionTest<RefX1<double>[,]>(true);
+ Gen.ExceptionTest<RefX1<string>[][][]>(true);
+ Gen.ExceptionTest<RefX1<object>[,,,]>(true);
+ Gen.ExceptionTest<RefX1<Guid>[][,,,][]>(true);
+ Gen.ExceptionTest<RefX2<int,int>[]>(true);
+ Gen.ExceptionTest<RefX2<double,double>[,]>(true);
+ Gen.ExceptionTest<RefX2<string,string>[][][]>(true);
+ Gen.ExceptionTest<RefX2<object,object>[,,,]>(true);
+ Gen.ExceptionTest<RefX2<Guid,Guid>[][,,,][]>(true);
+ Gen.ExceptionTest<ValX1<int>[]>(true);
+ Gen.ExceptionTest<ValX1<double>[,]>(true);
+ Gen.ExceptionTest<ValX1<string>[][][]>(true);
+ Gen.ExceptionTest<ValX1<object>[,,,]>(true);
+ Gen.ExceptionTest<ValX1<Guid>[][,,,][]>(true);
+
+ Gen.ExceptionTest<ValX2<int,int>[]>(true);
+ Gen.ExceptionTest<ValX2<double,double>[,]>(true);
+ Gen.ExceptionTest<ValX2<string,string>[][][]>(true);
+ Gen.ExceptionTest<ValX2<object,object>[,,,]>(true);
+ Gen.ExceptionTest<ValX2<Guid,Guid>[][,,,][]>(true);
+
+ Gen.ExceptionTest<RefX1<int>>(true);
+ Gen.ExceptionTest<RefX1<ValX1<int>>>(true);
+ Gen.ExceptionTest<RefX2<int,string>>(true);
+ Gen.ExceptionTest<RefX3<int,string,Guid>>(true);
+
+ Gen.ExceptionTest<RefX1<RefX1<int>>>(true);
+ Gen.ExceptionTest<RefX1<RefX1<RefX1<string>>>>(true);
+ Gen.ExceptionTest<RefX1<RefX1<RefX1<RefX1<Guid>>>>>(true);
+
+ Gen.ExceptionTest<RefX1<RefX2<int,string>>>(true);
+ Gen.ExceptionTest<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>(true);
+ Gen.ExceptionTest<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+ Gen.ExceptionTest<ValX1<int>>(true);
+ Gen.ExceptionTest<ValX1<RefX1<int>>>(true);
+ Gen.ExceptionTest<ValX2<int,string>>(true);
+ Gen.ExceptionTest<ValX3<int,string,Guid>>(true);
+
+ Gen.ExceptionTest<ValX1<ValX1<int>>>(true);
+ Gen.ExceptionTest<ValX1<ValX1<ValX1<string>>>>(true);
+ Gen.ExceptionTest<ValX1<ValX1<ValX1<ValX1<Guid>>>>>(true);
+
+ Gen.ExceptionTest<ValX1<ValX2<int,string>>>(true);
+ Gen.ExceptionTest<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>(true);
+ Gen.ExceptionTest<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct08.csproj b/tests/src/baseservices/exceptions/generics/try-catch-struct08.csproj
new file mode 100644
index 0000000000..e0a740b8b1
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct08.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-struct08.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct09.cs b/tests/src/baseservices/exceptions/generics/try-catch-struct09.cs
new file mode 100644
index 0000000000..60c1483577
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct09.cs
@@ -0,0 +1,141 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public struct Gen
+{
+ public static void ExceptionTest<U>(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<U>();
+ }
+ Test.Eval(!throwException);
+ }
+ catch(GenException<U>)
+ {
+ Test.Eval(throwException);
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ExceptionTest<int>(true);
+ Gen.ExceptionTest<double>(true);
+ Gen.ExceptionTest<string>(true);
+ Gen.ExceptionTest<object>(true);
+ Gen.ExceptionTest<Guid>(true);
+
+ Gen.ExceptionTest<int[]>(true);
+ Gen.ExceptionTest<double[,]>(true);
+ Gen.ExceptionTest<string[][][]>(true);
+ Gen.ExceptionTest<object[,,,]>(true);
+ Gen.ExceptionTest<Guid[][,,,][]>(true);
+
+ Gen.ExceptionTest<RefX1<int>[]>(true);
+ Gen.ExceptionTest<RefX1<double>[,]>(true);
+ Gen.ExceptionTest<RefX1<string>[][][]>(true);
+ Gen.ExceptionTest<RefX1<object>[,,,]>(true);
+ Gen.ExceptionTest<RefX1<Guid>[][,,,][]>(true);
+ Gen.ExceptionTest<RefX2<int,int>[]>(true);
+ Gen.ExceptionTest<RefX2<double,double>[,]>(true);
+ Gen.ExceptionTest<RefX2<string,string>[][][]>(true);
+ Gen.ExceptionTest<RefX2<object,object>[,,,]>(true);
+ Gen.ExceptionTest<RefX2<Guid,Guid>[][,,,][]>(true);
+ Gen.ExceptionTest<ValX1<int>[]>(true);
+ Gen.ExceptionTest<ValX1<double>[,]>(true);
+ Gen.ExceptionTest<ValX1<string>[][][]>(true);
+ Gen.ExceptionTest<ValX1<object>[,,,]>(true);
+ Gen.ExceptionTest<ValX1<Guid>[][,,,][]>(true);
+
+ Gen.ExceptionTest<ValX2<int,int>[]>(true);
+ Gen.ExceptionTest<ValX2<double,double>[,]>(true);
+ Gen.ExceptionTest<ValX2<string,string>[][][]>(true);
+ Gen.ExceptionTest<ValX2<object,object>[,,,]>(true);
+ Gen.ExceptionTest<ValX2<Guid,Guid>[][,,,][]>(true);
+
+ Gen.ExceptionTest<RefX1<int>>(true);
+ Gen.ExceptionTest<RefX1<ValX1<int>>>(true);
+ Gen.ExceptionTest<RefX2<int,string>>(true);
+ Gen.ExceptionTest<RefX3<int,string,Guid>>(true);
+
+ Gen.ExceptionTest<RefX1<RefX1<int>>>(true);
+ Gen.ExceptionTest<RefX1<RefX1<RefX1<string>>>>(true);
+ Gen.ExceptionTest<RefX1<RefX1<RefX1<RefX1<Guid>>>>>(true);
+
+ Gen.ExceptionTest<RefX1<RefX2<int,string>>>(true);
+ Gen.ExceptionTest<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>(true);
+ Gen.ExceptionTest<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+ Gen.ExceptionTest<ValX1<int>>(true);
+ Gen.ExceptionTest<ValX1<RefX1<int>>>(true);
+ Gen.ExceptionTest<ValX2<int,string>>(true);
+ Gen.ExceptionTest<ValX3<int,string,Guid>>(true);
+
+ Gen.ExceptionTest<ValX1<ValX1<int>>>(true);
+ Gen.ExceptionTest<ValX1<ValX1<ValX1<string>>>>(true);
+ Gen.ExceptionTest<ValX1<ValX1<ValX1<ValX1<Guid>>>>>(true);
+
+ Gen.ExceptionTest<ValX1<ValX2<int,string>>>(true);
+ Gen.ExceptionTest<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>(true);
+ Gen.ExceptionTest<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch-struct09.csproj b/tests/src/baseservices/exceptions/generics/try-catch-struct09.csproj
new file mode 100644
index 0000000000..f7dec8f25a
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch-struct09.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch-struct09.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch01.cs b/tests/src/baseservices/exceptions/generics/try-catch01.cs
new file mode 100644
index 0000000000..fd2214618a
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch01.cs
@@ -0,0 +1,145 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void InternalExceptionTest(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<T>);
+ }
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ InternalExceptionTest(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch01.csproj b/tests/src/baseservices/exceptions/generics/try-catch01.csproj
new file mode 100644
index 0000000000..1220178615
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch01.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch02.cs b/tests/src/baseservices/exceptions/generics/try-catch02.cs
new file mode 100644
index 0000000000..5be6669975
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch02.cs
@@ -0,0 +1,141 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ catch(GenException<T>)
+ {
+ Test.Eval(throwException);
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch02.csproj b/tests/src/baseservices/exceptions/generics/try-catch02.csproj
new file mode 100644
index 0000000000..d17d2814ed
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch02.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch03.cs b/tests/src/baseservices/exceptions/generics/try-catch03.cs
new file mode 100644
index 0000000000..a613afa131
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch03.cs
@@ -0,0 +1,155 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void InternalExceptionTest(bool throwException)
+ {
+ string ExceptionClass = typeof(GenException<T>).ToString();
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(GenException<System.InvalidCastException>)
+ {
+ //this should never bee hit!
+ Test.Eval(false);
+ }
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ InternalExceptionTest(throwException);
+ Test.Eval(!throwException);
+ }
+ catch
+ {
+ Test.Eval(throwException);
+ }
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch03.csproj b/tests/src/baseservices/exceptions/generics/try-catch03.csproj
new file mode 100644
index 0000000000..6853ebc5da
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch03.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch04.cs b/tests/src/baseservices/exceptions/generics/try-catch04.cs
new file mode 100644
index 0000000000..466b1faa71
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch04.cs
@@ -0,0 +1,145 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public static void InternalExceptionTest(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<T>);
+ }
+ }
+
+ public static void ExceptionTest(bool throwException)
+ {
+ InternalExceptionTest(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ExceptionTest(true);
+ Gen<double>.ExceptionTest(true);
+ Gen<string>.ExceptionTest(true);
+ Gen<object>.ExceptionTest(true);
+ Gen<Guid>.ExceptionTest(true);
+
+ Gen<int[]>.ExceptionTest(true);
+ Gen<double[,]>.ExceptionTest(true);
+ Gen<string[][][]>.ExceptionTest(true);
+ Gen<object[,,,]>.ExceptionTest(true);
+ Gen<Guid[][,,,][]>.ExceptionTest(true);
+
+ Gen<RefX1<int>[]>.ExceptionTest(true);
+ Gen<RefX1<double>[,]>.ExceptionTest(true);
+ Gen<RefX1<string>[][][]>.ExceptionTest(true);
+ Gen<RefX1<object>[,,,]>.ExceptionTest(true);
+ Gen<RefX1<Guid>[][,,,][]>.ExceptionTest(true);
+ Gen<RefX2<int,int>[]>.ExceptionTest(true);
+ Gen<RefX2<double,double>[,]>.ExceptionTest(true);
+ Gen<RefX2<string,string>[][][]>.ExceptionTest(true);
+ Gen<RefX2<object,object>[,,,]>.ExceptionTest(true);
+ Gen<RefX2<Guid,Guid>[][,,,][]>.ExceptionTest(true);
+ Gen<ValX1<int>[]>.ExceptionTest(true);
+ Gen<ValX1<double>[,]>.ExceptionTest(true);
+ Gen<ValX1<string>[][][]>.ExceptionTest(true);
+ Gen<ValX1<object>[,,,]>.ExceptionTest(true);
+ Gen<ValX1<Guid>[][,,,][]>.ExceptionTest(true);
+
+ Gen<ValX2<int,int>[]>.ExceptionTest(true);
+ Gen<ValX2<double,double>[,]>.ExceptionTest(true);
+ Gen<ValX2<string,string>[][][]>.ExceptionTest(true);
+ Gen<ValX2<object,object>[,,,]>.ExceptionTest(true);
+ Gen<ValX2<Guid,Guid>[][,,,][]>.ExceptionTest(true);
+
+ Gen<RefX1<int>>.ExceptionTest(true);
+ Gen<RefX1<ValX1<int>>>.ExceptionTest(true);
+ Gen<RefX2<int,string>>.ExceptionTest(true);
+ Gen<RefX3<int,string,Guid>>.ExceptionTest(true);
+
+ Gen<RefX1<RefX1<int>>>.ExceptionTest(true);
+ Gen<RefX1<RefX1<RefX1<string>>>>.ExceptionTest(true);
+ Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>.ExceptionTest(true);
+
+ Gen<RefX1<RefX2<int,string>>>.ExceptionTest(true);
+ Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>.ExceptionTest(true);
+ Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>.ExceptionTest(true);
+
+ Gen<ValX1<int>>.ExceptionTest(true);
+ Gen<ValX1<RefX1<int>>>.ExceptionTest(true);
+ Gen<ValX2<int,string>>.ExceptionTest(true);
+ Gen<ValX3<int,string,Guid>>.ExceptionTest(true);
+
+ Gen<ValX1<ValX1<int>>>.ExceptionTest(true);
+ Gen<ValX1<ValX1<ValX1<string>>>>.ExceptionTest(true);
+ Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>.ExceptionTest(true);
+
+ Gen<ValX1<ValX2<int,string>>>.ExceptionTest(true);
+ Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>.ExceptionTest(true);
+ Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>.ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch04.csproj b/tests/src/baseservices/exceptions/generics/try-catch04.csproj
new file mode 100644
index 0000000000..f12fcdbde4
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch04.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch04.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch05.cs b/tests/src/baseservices/exceptions/generics/try-catch05.cs
new file mode 100644
index 0000000000..646695afea
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch05.cs
@@ -0,0 +1,142 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public static void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ catch(GenException<T>)
+ {
+ Test.Eval(throwException);
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ExceptionTest(true);
+ Gen<double>.ExceptionTest(true);
+ Gen<string>.ExceptionTest(true);
+ Gen<object>.ExceptionTest(true);
+ Gen<Guid>.ExceptionTest(true);
+
+ Gen<int[]>.ExceptionTest(true);
+ Gen<double[,]>.ExceptionTest(true);
+ Gen<string[][][]>.ExceptionTest(true);
+ Gen<object[,,,]>.ExceptionTest(true);
+ Gen<Guid[][,,,][]>.ExceptionTest(true);
+
+ Gen<RefX1<int>[]>.ExceptionTest(true);
+ Gen<RefX1<double>[,]>.ExceptionTest(true);
+ Gen<RefX1<string>[][][]>.ExceptionTest(true);
+ Gen<RefX1<object>[,,,]>.ExceptionTest(true);
+ Gen<RefX1<Guid>[][,,,][]>.ExceptionTest(true);
+ Gen<RefX2<int,int>[]>.ExceptionTest(true);
+ Gen<RefX2<double,double>[,]>.ExceptionTest(true);
+ Gen<RefX2<string,string>[][][]>.ExceptionTest(true);
+ Gen<RefX2<object,object>[,,,]>.ExceptionTest(true);
+ Gen<RefX2<Guid,Guid>[][,,,][]>.ExceptionTest(true);
+ Gen<ValX1<int>[]>.ExceptionTest(true);
+ Gen<ValX1<double>[,]>.ExceptionTest(true);
+ Gen<ValX1<string>[][][]>.ExceptionTest(true);
+ Gen<ValX1<object>[,,,]>.ExceptionTest(true);
+ Gen<ValX1<Guid>[][,,,][]>.ExceptionTest(true);
+
+ Gen<ValX2<int,int>[]>.ExceptionTest(true);
+ Gen<ValX2<double,double>[,]>.ExceptionTest(true);
+ Gen<ValX2<string,string>[][][]>.ExceptionTest(true);
+ Gen<ValX2<object,object>[,,,]>.ExceptionTest(true);
+ Gen<ValX2<Guid,Guid>[][,,,][]>.ExceptionTest(true);
+
+ Gen<RefX1<int>>.ExceptionTest(true);
+ Gen<RefX1<ValX1<int>>>.ExceptionTest(true);
+ Gen<RefX2<int,string>>.ExceptionTest(true);
+ Gen<RefX3<int,string,Guid>>.ExceptionTest(true);
+
+ Gen<RefX1<RefX1<int>>>.ExceptionTest(true);
+ Gen<RefX1<RefX1<RefX1<string>>>>.ExceptionTest(true);
+ Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>.ExceptionTest(true);
+
+ Gen<RefX1<RefX2<int,string>>>.ExceptionTest(true);
+ Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>.ExceptionTest(true);
+ Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>.ExceptionTest(true);
+
+ Gen<ValX1<int>>.ExceptionTest(true);
+ Gen<ValX1<RefX1<int>>>.ExceptionTest(true);
+ Gen<ValX2<int,string>>.ExceptionTest(true);
+ Gen<ValX3<int,string,Guid>>.ExceptionTest(true);
+
+ Gen<ValX1<ValX1<int>>>.ExceptionTest(true);
+ Gen<ValX1<ValX1<ValX1<string>>>>.ExceptionTest(true);
+ Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>.ExceptionTest(true);
+
+ Gen<ValX1<ValX2<int,string>>>.ExceptionTest(true);
+ Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>.ExceptionTest(true);
+ Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>.ExceptionTest(true);
+
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch05.csproj b/tests/src/baseservices/exceptions/generics/try-catch05.csproj
new file mode 100644
index 0000000000..e2180672d5
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch05.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch05.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch06.cs b/tests/src/baseservices/exceptions/generics/try-catch06.cs
new file mode 100644
index 0000000000..499ff15ae3
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch06.cs
@@ -0,0 +1,145 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen
+{
+ public void InternalExceptionTest<U>(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<U>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<U>);
+ }
+ }
+
+ public void ExceptionTest<U>(bool throwException)
+ {
+ InternalExceptionTest<U>(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen().ExceptionTest<int>(true);
+ new Gen().ExceptionTest<double>(true);
+ new Gen().ExceptionTest<string>(true);
+ new Gen().ExceptionTest<object>(true);
+ new Gen().ExceptionTest<Guid>(true);
+
+ new Gen().ExceptionTest<int[]>(true);
+ new Gen().ExceptionTest<double[,]>(true);
+ new Gen().ExceptionTest<string[][][]>(true);
+ new Gen().ExceptionTest<object[,,,]>(true);
+ new Gen().ExceptionTest<Guid[][,,,][]>(true);
+
+ new Gen().ExceptionTest<RefX1<int>[]>(true);
+ new Gen().ExceptionTest<RefX1<double>[,]>(true);
+ new Gen().ExceptionTest<RefX1<string>[][][]>(true);
+ new Gen().ExceptionTest<RefX1<object>[,,,]>(true);
+ new Gen().ExceptionTest<RefX1<Guid>[][,,,][]>(true);
+ new Gen().ExceptionTest<RefX2<int,int>[]>(true);
+ new Gen().ExceptionTest<RefX2<double,double>[,]>(true);
+ new Gen().ExceptionTest<RefX2<string,string>[][][]>(true);
+ new Gen().ExceptionTest<RefX2<object,object>[,,,]>(true);
+ new Gen().ExceptionTest<RefX2<Guid,Guid>[][,,,][]>(true);
+ new Gen().ExceptionTest<ValX1<int>[]>(true);
+ new Gen().ExceptionTest<ValX1<double>[,]>(true);
+ new Gen().ExceptionTest<ValX1<string>[][][]>(true);
+ new Gen().ExceptionTest<ValX1<object>[,,,]>(true);
+ new Gen().ExceptionTest<ValX1<Guid>[][,,,][]>(true);
+
+ new Gen().ExceptionTest<ValX2<int,int>[]>(true);
+ new Gen().ExceptionTest<ValX2<double,double>[,]>(true);
+ new Gen().ExceptionTest<ValX2<string,string>[][][]>(true);
+ new Gen().ExceptionTest<ValX2<object,object>[,,,]>(true);
+ new Gen().ExceptionTest<ValX2<Guid,Guid>[][,,,][]>(true);
+
+ new Gen().ExceptionTest<RefX1<int>>(true);
+ new Gen().ExceptionTest<RefX1<ValX1<int>>>(true);
+ new Gen().ExceptionTest<RefX2<int,string>>(true);
+ new Gen().ExceptionTest<RefX3<int,string,Guid>>(true);
+
+ new Gen().ExceptionTest<RefX1<RefX1<int>>>(true);
+ new Gen().ExceptionTest<RefX1<RefX1<RefX1<string>>>>(true);
+ new Gen().ExceptionTest<RefX1<RefX1<RefX1<RefX1<Guid>>>>>(true);
+
+ new Gen().ExceptionTest<RefX1<RefX2<int,string>>>(true);
+ new Gen().ExceptionTest<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>(true);
+ new Gen().ExceptionTest<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+ new Gen().ExceptionTest<ValX1<int>>(true);
+ new Gen().ExceptionTest<ValX1<RefX1<int>>>(true);
+ new Gen().ExceptionTest<ValX2<int,string>>(true);
+ new Gen().ExceptionTest<ValX3<int,string,Guid>>(true);
+
+ new Gen().ExceptionTest<ValX1<ValX1<int>>>(true);
+ new Gen().ExceptionTest<ValX1<ValX1<ValX1<string>>>>(true);
+ new Gen().ExceptionTest<ValX1<ValX1<ValX1<ValX1<Guid>>>>>(true);
+
+ new Gen().ExceptionTest<ValX1<ValX2<int,string>>>(true);
+ new Gen().ExceptionTest<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>(true);
+ new Gen().ExceptionTest<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch06.csproj b/tests/src/baseservices/exceptions/generics/try-catch06.csproj
new file mode 100644
index 0000000000..2836f093c8
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch06.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch06.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch07.cs b/tests/src/baseservices/exceptions/generics/try-catch07.cs
new file mode 100644
index 0000000000..9db15a318f
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch07.cs
@@ -0,0 +1,142 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen
+{
+ public void ExceptionTest<U>(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<U>();
+ }
+ Test.Eval(!throwException);
+ }
+ catch(GenException<U>)
+ {
+ Test.Eval(throwException);
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen().ExceptionTest<int>(true);
+ new Gen().ExceptionTest<double>(true);
+ new Gen().ExceptionTest<string>(true);
+ new Gen().ExceptionTest<object>(true);
+ new Gen().ExceptionTest<Guid>(true);
+
+ new Gen().ExceptionTest<int[]>(true);
+ new Gen().ExceptionTest<double[,]>(true);
+ new Gen().ExceptionTest<string[][][]>(true);
+ new Gen().ExceptionTest<object[,,,]>(true);
+ new Gen().ExceptionTest<Guid[][,,,][]>(true);
+
+ new Gen().ExceptionTest<RefX1<int>[]>(true);
+ new Gen().ExceptionTest<RefX1<double>[,]>(true);
+ new Gen().ExceptionTest<RefX1<string>[][][]>(true);
+ new Gen().ExceptionTest<RefX1<object>[,,,]>(true);
+ new Gen().ExceptionTest<RefX1<Guid>[][,,,][]>(true);
+ new Gen().ExceptionTest<RefX2<int,int>[]>(true);
+ new Gen().ExceptionTest<RefX2<double,double>[,]>(true);
+ new Gen().ExceptionTest<RefX2<string,string>[][][]>(true);
+ new Gen().ExceptionTest<RefX2<object,object>[,,,]>(true);
+ new Gen().ExceptionTest<RefX2<Guid,Guid>[][,,,][]>(true);
+ new Gen().ExceptionTest<ValX1<int>[]>(true);
+ new Gen().ExceptionTest<ValX1<double>[,]>(true);
+ new Gen().ExceptionTest<ValX1<string>[][][]>(true);
+ new Gen().ExceptionTest<ValX1<object>[,,,]>(true);
+ new Gen().ExceptionTest<ValX1<Guid>[][,,,][]>(true);
+
+ new Gen().ExceptionTest<ValX2<int,int>[]>(true);
+ new Gen().ExceptionTest<ValX2<double,double>[,]>(true);
+ new Gen().ExceptionTest<ValX2<string,string>[][][]>(true);
+ new Gen().ExceptionTest<ValX2<object,object>[,,,]>(true);
+ new Gen().ExceptionTest<ValX2<Guid,Guid>[][,,,][]>(true);
+
+ new Gen().ExceptionTest<RefX1<int>>(true);
+ new Gen().ExceptionTest<RefX1<ValX1<int>>>(true);
+ new Gen().ExceptionTest<RefX2<int,string>>(true);
+ new Gen().ExceptionTest<RefX3<int,string,Guid>>(true);
+
+ new Gen().ExceptionTest<RefX1<RefX1<int>>>(true);
+ new Gen().ExceptionTest<RefX1<RefX1<RefX1<string>>>>(true);
+ new Gen().ExceptionTest<RefX1<RefX1<RefX1<RefX1<Guid>>>>>(true);
+
+ new Gen().ExceptionTest<RefX1<RefX2<int,string>>>(true);
+ new Gen().ExceptionTest<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>(true);
+ new Gen().ExceptionTest<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+ new Gen().ExceptionTest<ValX1<int>>(true);
+ new Gen().ExceptionTest<ValX1<RefX1<int>>>(true);
+ new Gen().ExceptionTest<ValX2<int,string>>(true);
+ new Gen().ExceptionTest<ValX3<int,string,Guid>>(true);
+
+ new Gen().ExceptionTest<ValX1<ValX1<int>>>(true);
+ new Gen().ExceptionTest<ValX1<ValX1<ValX1<string>>>>(true);
+ new Gen().ExceptionTest<ValX1<ValX1<ValX1<ValX1<Guid>>>>>(true);
+
+ new Gen().ExceptionTest<ValX1<ValX2<int,string>>>(true);
+ new Gen().ExceptionTest<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>(true);
+ new Gen().ExceptionTest<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch07.csproj b/tests/src/baseservices/exceptions/generics/try-catch07.csproj
new file mode 100644
index 0000000000..5625f632ed
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch07.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch07.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch08.cs b/tests/src/baseservices/exceptions/generics/try-catch08.cs
new file mode 100644
index 0000000000..0fe69d6ac6
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch08.cs
@@ -0,0 +1,145 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen
+{
+ public static void InternalExceptionTest<U>(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<U>();
+ }
+ if (throwException)
+ {
+ Test.Eval(false);
+ }
+ }
+ catch(Exception E)
+ {
+ Test.Eval(E is GenException<U>);
+ }
+ }
+
+ public static void ExceptionTest<U>(bool throwException)
+ {
+ InternalExceptionTest<U>(throwException);
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ExceptionTest<int>(true);
+ Gen.ExceptionTest<double>(true);
+ Gen.ExceptionTest<string>(true);
+ Gen.ExceptionTest<object>(true);
+ Gen.ExceptionTest<Guid>(true);
+
+ Gen.ExceptionTest<int[]>(true);
+ Gen.ExceptionTest<double[,]>(true);
+ Gen.ExceptionTest<string[][][]>(true);
+ Gen.ExceptionTest<object[,,,]>(true);
+ Gen.ExceptionTest<Guid[][,,,][]>(true);
+
+ Gen.ExceptionTest<RefX1<int>[]>(true);
+ Gen.ExceptionTest<RefX1<double>[,]>(true);
+ Gen.ExceptionTest<RefX1<string>[][][]>(true);
+ Gen.ExceptionTest<RefX1<object>[,,,]>(true);
+ Gen.ExceptionTest<RefX1<Guid>[][,,,][]>(true);
+ Gen.ExceptionTest<RefX2<int,int>[]>(true);
+ Gen.ExceptionTest<RefX2<double,double>[,]>(true);
+ Gen.ExceptionTest<RefX2<string,string>[][][]>(true);
+ Gen.ExceptionTest<RefX2<object,object>[,,,]>(true);
+ Gen.ExceptionTest<RefX2<Guid,Guid>[][,,,][]>(true);
+ Gen.ExceptionTest<ValX1<int>[]>(true);
+ Gen.ExceptionTest<ValX1<double>[,]>(true);
+ Gen.ExceptionTest<ValX1<string>[][][]>(true);
+ Gen.ExceptionTest<ValX1<object>[,,,]>(true);
+ Gen.ExceptionTest<ValX1<Guid>[][,,,][]>(true);
+
+ Gen.ExceptionTest<ValX2<int,int>[]>(true);
+ Gen.ExceptionTest<ValX2<double,double>[,]>(true);
+ Gen.ExceptionTest<ValX2<string,string>[][][]>(true);
+ Gen.ExceptionTest<ValX2<object,object>[,,,]>(true);
+ Gen.ExceptionTest<ValX2<Guid,Guid>[][,,,][]>(true);
+
+ Gen.ExceptionTest<RefX1<int>>(true);
+ Gen.ExceptionTest<RefX1<ValX1<int>>>(true);
+ Gen.ExceptionTest<RefX2<int,string>>(true);
+ Gen.ExceptionTest<RefX3<int,string,Guid>>(true);
+
+ Gen.ExceptionTest<RefX1<RefX1<int>>>(true);
+ Gen.ExceptionTest<RefX1<RefX1<RefX1<string>>>>(true);
+ Gen.ExceptionTest<RefX1<RefX1<RefX1<RefX1<Guid>>>>>(true);
+
+ Gen.ExceptionTest<RefX1<RefX2<int,string>>>(true);
+ Gen.ExceptionTest<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>(true);
+ Gen.ExceptionTest<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+ Gen.ExceptionTest<ValX1<int>>(true);
+ Gen.ExceptionTest<ValX1<RefX1<int>>>(true);
+ Gen.ExceptionTest<ValX2<int,string>>(true);
+ Gen.ExceptionTest<ValX3<int,string,Guid>>(true);
+
+ Gen.ExceptionTest<ValX1<ValX1<int>>>(true);
+ Gen.ExceptionTest<ValX1<ValX1<ValX1<string>>>>(true);
+ Gen.ExceptionTest<ValX1<ValX1<ValX1<ValX1<Guid>>>>>(true);
+
+ Gen.ExceptionTest<ValX1<ValX2<int,string>>>(true);
+ Gen.ExceptionTest<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>(true);
+ Gen.ExceptionTest<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch08.csproj b/tests/src/baseservices/exceptions/generics/try-catch08.csproj
new file mode 100644
index 0000000000..31b4f32a8e
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch08.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch08.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-catch09.cs b/tests/src/baseservices/exceptions/generics/try-catch09.cs
new file mode 100644
index 0000000000..5b677a0271
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch09.cs
@@ -0,0 +1,141 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen
+{
+ public static void ExceptionTest<U>(bool throwException)
+ {
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<U>();
+ }
+ Test.Eval(!throwException);
+ }
+ catch(GenException<U>)
+ {
+ Test.Eval(throwException);
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ExceptionTest<int>(true);
+ Gen.ExceptionTest<double>(true);
+ Gen.ExceptionTest<string>(true);
+ Gen.ExceptionTest<object>(true);
+ Gen.ExceptionTest<Guid>(true);
+
+ Gen.ExceptionTest<int[]>(true);
+ Gen.ExceptionTest<double[,]>(true);
+ Gen.ExceptionTest<string[][][]>(true);
+ Gen.ExceptionTest<object[,,,]>(true);
+ Gen.ExceptionTest<Guid[][,,,][]>(true);
+
+ Gen.ExceptionTest<RefX1<int>[]>(true);
+ Gen.ExceptionTest<RefX1<double>[,]>(true);
+ Gen.ExceptionTest<RefX1<string>[][][]>(true);
+ Gen.ExceptionTest<RefX1<object>[,,,]>(true);
+ Gen.ExceptionTest<RefX1<Guid>[][,,,][]>(true);
+ Gen.ExceptionTest<RefX2<int,int>[]>(true);
+ Gen.ExceptionTest<RefX2<double,double>[,]>(true);
+ Gen.ExceptionTest<RefX2<string,string>[][][]>(true);
+ Gen.ExceptionTest<RefX2<object,object>[,,,]>(true);
+ Gen.ExceptionTest<RefX2<Guid,Guid>[][,,,][]>(true);
+ Gen.ExceptionTest<ValX1<int>[]>(true);
+ Gen.ExceptionTest<ValX1<double>[,]>(true);
+ Gen.ExceptionTest<ValX1<string>[][][]>(true);
+ Gen.ExceptionTest<ValX1<object>[,,,]>(true);
+ Gen.ExceptionTest<ValX1<Guid>[][,,,][]>(true);
+
+ Gen.ExceptionTest<ValX2<int,int>[]>(true);
+ Gen.ExceptionTest<ValX2<double,double>[,]>(true);
+ Gen.ExceptionTest<ValX2<string,string>[][][]>(true);
+ Gen.ExceptionTest<ValX2<object,object>[,,,]>(true);
+ Gen.ExceptionTest<ValX2<Guid,Guid>[][,,,][]>(true);
+
+ Gen.ExceptionTest<RefX1<int>>(true);
+ Gen.ExceptionTest<RefX1<ValX1<int>>>(true);
+ Gen.ExceptionTest<RefX2<int,string>>(true);
+ Gen.ExceptionTest<RefX3<int,string,Guid>>(true);
+
+ Gen.ExceptionTest<RefX1<RefX1<int>>>(true);
+ Gen.ExceptionTest<RefX1<RefX1<RefX1<string>>>>(true);
+ Gen.ExceptionTest<RefX1<RefX1<RefX1<RefX1<Guid>>>>>(true);
+
+ Gen.ExceptionTest<RefX1<RefX2<int,string>>>(true);
+ Gen.ExceptionTest<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>(true);
+ Gen.ExceptionTest<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+ Gen.ExceptionTest<ValX1<int>>(true);
+ Gen.ExceptionTest<ValX1<RefX1<int>>>(true);
+ Gen.ExceptionTest<ValX2<int,string>>(true);
+ Gen.ExceptionTest<ValX3<int,string,Guid>>(true);
+
+ Gen.ExceptionTest<ValX1<ValX1<int>>>(true);
+ Gen.ExceptionTest<ValX1<ValX1<ValX1<string>>>>(true);
+ Gen.ExceptionTest<ValX1<ValX1<ValX1<ValX1<Guid>>>>>(true);
+
+ Gen.ExceptionTest<ValX1<ValX2<int,string>>>(true);
+ Gen.ExceptionTest<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>(true);
+ Gen.ExceptionTest<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-catch09.csproj b/tests/src/baseservices/exceptions/generics/try-catch09.csproj
new file mode 100644
index 0000000000..ef0f5e58c6
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-catch09.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-catch09.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-fault-struct01.il b/tests/src/baseservices/exceptions/generics/try-fault-struct01.il
new file mode 100644
index 0000000000..fac44bff48
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-fault-struct01.il
@@ -0,0 +1,776 @@
+// 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.
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 1.2.2211.0
+// Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
+
+
+
+// Metadata version: v1.1.2211
+.assembly extern legacy library mscorlib {}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+.assembly 'try-finally01'
+{
+
+ // --- The following custom attribute is added automatically, do not uncomment -------
+ // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
+ // bool) = ( 01 00 00 01 00 00 )
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'try-finally01.exe'
+// MVID: {736049C4-A4DA-41B1-895D-B9E4A517BBE4}
+.imagebase 0x00400000
+.subsystem 0x00000003
+.file alignment 512
+.corflags 0x00000001
+// Image base: 0x02DB0000
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public sequential ansi sealed beforefieldinit ValX0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX0
+
+.class public sequential ansi sealed beforefieldinit ValY0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY0
+
+.class public sequential ansi sealed beforefieldinit ValX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX1
+
+.class public sequential ansi sealed beforefieldinit ValY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY1
+
+.class public sequential ansi sealed beforefieldinit ValX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX2
+
+.class public sequential ansi sealed beforefieldinit ValY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY2
+
+.class public sequential ansi sealed beforefieldinit ValX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX3
+
+.class public sequential ansi sealed beforefieldinit ValY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY3
+
+.class public auto ansi beforefieldinit RefX0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX0::.ctor
+
+} // end of class RefX0
+
+.class public auto ansi beforefieldinit RefY0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY0::.ctor
+
+} // end of class RefY0
+
+.class public auto ansi beforefieldinit RefX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX1::.ctor
+
+} // end of class RefX1
+
+.class public auto ansi beforefieldinit RefY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY1::.ctor
+
+} // end of class RefY1
+
+.class public auto ansi beforefieldinit RefX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX2::.ctor
+
+} // end of class RefX2
+
+.class public auto ansi beforefieldinit RefY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY2::.ctor
+
+} // end of class RefY2
+
+.class public auto ansi beforefieldinit RefX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX3::.ctor
+
+} // end of class RefX3
+
+.class public auto ansi beforefieldinit RefY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY3::.ctor
+
+} // end of class RefY3
+
+.class public auto ansi beforefieldinit GenException<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Exception
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Exception::.ctor()
+ IL_0006: ret
+ } // end of method GenException::.ctor
+
+} // end of class GenException
+
+.class public sequential ansi sealed beforefieldinit Gen<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .method public hidebysig instance void
+ InternalExceptionTest(bool throwException) cil managed
+ {
+ // Code size 53 (0x35)
+ .maxstack 2
+ .locals init (string V_0)
+ IL_0000: ldtoken class GenException<!0>
+ IL_0005: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ IL_000a: callvirt instance string [mscorlib]System.Type::ToString()
+ IL_000f: stloc.0
+ .try
+ {
+ IL_0010: ldarg.1
+ IL_0011: brfalse.s IL_0019
+
+ IL_0013: newobj instance void class GenException<!0>::.ctor()
+ IL_0018: throw
+
+ IL_0019: ldarg.1
+ IL_001a: ldc.i4.0
+ IL_001b: ceq
+ IL_001d: call void Test::Eval(bool)
+ IL_0022: leave.s IL_002b
+
+ } // end .try
+ fault
+ {
+ IL_0024: ldarg.1
+ IL_0025: call void Test::Eval(bool)
+ IL_002a: endfault
+ } // end handler
+ IL_002b: ldarg.1
+ IL_002c: ldc.i4.0
+ IL_002d: ceq
+ IL_002f: call void Test::Eval(bool)
+ IL_0034: ret
+ } // end of method Gen::InternalExceptionTest
+
+ .method public hidebysig instance void
+ ExceptionTest(bool throwException) cil managed
+ {
+ // Code size 28 (0x1c)
+ .maxstack 2
+ .try
+ {
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: call instance void valuetype Gen<!0>::InternalExceptionTest(bool)
+ IL_0007: ldarg.1
+ IL_0008: ldc.i4.0
+ IL_0009: ceq
+ IL_000b: call void Test::Eval(bool)
+ IL_0010: leave.s IL_001b
+
+ } // end .try
+ catch [mscorlib]System.Object
+ {
+ IL_0012: pop
+ IL_0013: ldarg.1
+ IL_0014: call void Test::Eval(bool)
+ IL_0019: leave.s IL_001b
+
+ } // end handler
+ IL_001b: ret
+ } // end of method Gen::ExceptionTest
+} // end of class Gen
+
+.class public auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+{
+ .field public static int32 counter
+ .field public static bool result
+ .method public hidebysig static void Eval(bool exp) cil managed
+ {
+ // Code size 47 (0x2f)
+ .maxstack 8
+ IL_0000: ldsfld int32 Test::counter
+ IL_0005: ldc.i4.1
+ IL_0006: add
+ IL_0007: stsfld int32 Test::counter
+ IL_000c: ldarg.0
+ IL_000d: brtrue.s IL_002e
+
+ IL_000f: ldarg.0
+ IL_0010: stsfld bool Test::result
+ IL_0015: ldstr "Test Failed at location: "
+ IL_001a: ldsfld int32 Test::counter
+ IL_001f: box [mscorlib]System.Int32
+ IL_0024: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0029: call void [System.Console]System.Console::WriteLine(string)
+ IL_002e: ret
+ } // end of method Test::Eval
+
+ .method public hidebysig static int32 Main() cil managed
+{
+ .entrypoint
+ // Code size 1032 (0x408)
+ .maxstack 2
+ .locals init (int32 V_0,
+ valuetype Gen<int32> V_1,
+ valuetype Gen<float64> V_2,
+ valuetype Gen<string> V_3,
+ valuetype Gen<object> V_4,
+ valuetype Gen<valuetype [mscorlib]System.Guid> V_5,
+ valuetype Gen<int32[]> V_6,
+ valuetype Gen<float64[0...,0...]> V_7,
+ valuetype Gen<string[][][]> V_8,
+ valuetype Gen<object[0...,0...,0...,0...]> V_9,
+ valuetype Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]> V_10,
+ valuetype Gen<class RefX1<int32>[]> V_11,
+ valuetype Gen<class RefX1<float64>[0...,0...]> V_12,
+ valuetype Gen<class RefX1<string>[][][]> V_13,
+ valuetype Gen<class RefX1<object>[0...,0...,0...,0...]> V_14,
+ valuetype Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_15,
+ valuetype Gen<class RefX2<int32,int32>[]> V_16,
+ valuetype Gen<class RefX2<float64,float64>[0...,0...]> V_17,
+ valuetype Gen<class RefX2<string,string>[][][]> V_18,
+ valuetype Gen<class RefX2<object,object>[0...,0...,0...,0...]> V_19,
+ valuetype Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_20,
+ valuetype Gen<valuetype ValX1<int32>[]> V_21,
+ valuetype Gen<valuetype ValX1<float64>[0...,0...]> V_22,
+ valuetype Gen<valuetype ValX1<string>[][][]> V_23,
+ valuetype Gen<valuetype ValX1<object>[0...,0...,0...,0...]> V_24,
+ valuetype Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_25,
+ valuetype Gen<valuetype ValX2<int32,int32>[]> V_26,
+ valuetype Gen<valuetype ValX2<float64,float64>[0...,0...]> V_27,
+ valuetype Gen<valuetype ValX2<string,string>[][][]> V_28,
+ valuetype Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]> V_29,
+ valuetype Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_30,
+ valuetype Gen<class RefX1<int32>> V_31,
+ valuetype Gen<class RefX1<valuetype ValX1<int32>>> V_32,
+ valuetype Gen<class RefX2<int32,string>> V_33,
+ valuetype Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>> V_34,
+ valuetype Gen<class RefX1<class RefX1<int32>>> V_35,
+ valuetype Gen<class RefX1<class RefX1<class RefX1<string>>>> V_36,
+ valuetype Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>> V_37,
+ valuetype Gen<class RefX1<class RefX2<int32,string>>> V_38,
+ valuetype Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>> V_39,
+ valuetype Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>> V_40,
+ valuetype Gen<valuetype ValX1<int32>> V_41,
+ valuetype Gen<valuetype ValX1<class RefX1<int32>>> V_42,
+ valuetype Gen<valuetype ValX2<int32,string>> V_43,
+ valuetype Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>> V_44,
+ valuetype Gen<valuetype ValX1<valuetype ValX1<int32>>> V_45,
+ valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>> V_46,
+ valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>> V_47,
+ valuetype Gen<valuetype ValX1<valuetype ValX2<int32,string>>> V_48,
+ valuetype Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>> V_49,
+ valuetype Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>> V_50)
+ IL_0000: ldloca.s V_1
+ IL_0002: initobj valuetype Gen<int32>
+ IL_0008: ldloc.1
+ IL_0009: stloc.1
+ IL_000a: ldloca.s V_1
+ IL_000c: ldc.i4.1
+ IL_000d: call instance void valuetype Gen<int32>::ExceptionTest(bool)
+ IL_0012: ldloca.s V_2
+ IL_0014: initobj valuetype Gen<float64>
+ IL_001a: ldloc.2
+ IL_001b: stloc.2
+ IL_001c: ldloca.s V_2
+ IL_001e: ldc.i4.1
+ IL_001f: call instance void valuetype Gen<float64>::ExceptionTest(bool)
+ IL_0024: ldloca.s V_3
+ IL_0026: initobj valuetype Gen<string>
+ IL_002c: ldloc.3
+ IL_002d: stloc.3
+ IL_002e: ldloca.s V_3
+ IL_0030: ldc.i4.1
+ IL_0031: call instance void valuetype Gen<string>::ExceptionTest(bool)
+ IL_0036: ldloca.s V_4
+ IL_0038: initobj valuetype Gen<object>
+ IL_003e: ldloc.s V_4
+ IL_0040: stloc.s V_4
+ IL_0042: ldloca.s V_4
+ IL_0044: ldc.i4.1
+ IL_0045: call instance void valuetype Gen<object>::ExceptionTest(bool)
+ IL_004a: ldloca.s V_5
+ IL_004c: initobj valuetype Gen<valuetype [mscorlib]System.Guid>
+ IL_0052: ldloc.s V_5
+ IL_0054: stloc.s V_5
+ IL_0056: ldloca.s V_5
+ IL_0058: ldc.i4.1
+ IL_0059: call instance void valuetype Gen<valuetype [mscorlib]System.Guid>::ExceptionTest(bool)
+ IL_005e: ldloca.s V_6
+ IL_0060: initobj valuetype Gen<int32[]>
+ IL_0066: ldloc.s V_6
+ IL_0068: stloc.s V_6
+ IL_006a: ldloca.s V_6
+ IL_006c: ldc.i4.1
+ IL_006d: call instance void valuetype Gen<int32[]>::ExceptionTest(bool)
+ IL_0072: ldloca.s V_7
+ IL_0074: initobj valuetype Gen<float64[0...,0...]>
+ IL_007a: ldloc.s V_7
+ IL_007c: stloc.s V_7
+ IL_007e: ldloca.s V_7
+ IL_0080: ldc.i4.1
+ IL_0081: call instance void valuetype Gen<float64[0...,0...]>::ExceptionTest(bool)
+ IL_0086: ldloca.s V_8
+ IL_0088: initobj valuetype Gen<string[][][]>
+ IL_008e: ldloc.s V_8
+ IL_0090: stloc.s V_8
+ IL_0092: ldloca.s V_8
+ IL_0094: ldc.i4.1
+ IL_0095: call instance void valuetype Gen<string[][][]>::ExceptionTest(bool)
+ IL_009a: ldloca.s V_9
+ IL_009c: initobj valuetype Gen<object[0...,0...,0...,0...]>
+ IL_00a2: ldloc.s V_9
+ IL_00a4: stloc.s V_9
+ IL_00a6: ldloca.s V_9
+ IL_00a8: ldc.i4.1
+ IL_00a9: call instance void valuetype Gen<object[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_00ae: ldloca.s V_10
+ IL_00b0: initobj valuetype Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>
+ IL_00b6: ldloc.s V_10
+ IL_00b8: stloc.s V_10
+ IL_00ba: ldloca.s V_10
+ IL_00bc: ldc.i4.1
+ IL_00bd: call instance void valuetype Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00c2: ldloca.s V_11
+ IL_00c4: initobj valuetype Gen<class RefX1<int32>[]>
+ IL_00ca: ldloc.s V_11
+ IL_00cc: stloc.s V_11
+ IL_00ce: ldloca.s V_11
+ IL_00d0: ldc.i4.1
+ IL_00d1: call instance void valuetype Gen<class RefX1<int32>[]>::ExceptionTest(bool)
+ IL_00d6: ldloca.s V_12
+ IL_00d8: initobj valuetype Gen<class RefX1<float64>[0...,0...]>
+ IL_00de: ldloc.s V_12
+ IL_00e0: stloc.s V_12
+ IL_00e2: ldloca.s V_12
+ IL_00e4: ldc.i4.1
+ IL_00e5: call instance void valuetype Gen<class RefX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00ea: ldloca.s V_13
+ IL_00ec: initobj valuetype Gen<class RefX1<string>[][][]>
+ IL_00f2: ldloc.s V_13
+ IL_00f4: stloc.s V_13
+ IL_00f6: ldloca.s V_13
+ IL_00f8: ldc.i4.1
+ IL_00f9: call instance void valuetype Gen<class RefX1<string>[][][]>::ExceptionTest(bool)
+ IL_00fe: ldloca.s V_14
+ IL_0100: initobj valuetype Gen<class RefX1<object>[0...,0...,0...,0...]>
+ IL_0106: ldloc.s V_14
+ IL_0108: stloc.s V_14
+ IL_010a: ldloca.s V_14
+ IL_010c: ldc.i4.1
+ IL_010d: call instance void valuetype Gen<class RefX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0112: ldloca.s V_15
+ IL_0114: initobj valuetype Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_011a: ldloc.s V_15
+ IL_011c: stloc.s V_15
+ IL_011e: ldloca.s V_15
+ IL_0120: ldc.i4.1
+ IL_0121: call instance void valuetype Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_0126: ldloca.s V_16
+ IL_0128: initobj valuetype Gen<class RefX2<int32,int32>[]>
+ IL_012e: ldloc.s V_16
+ IL_0130: stloc.s V_16
+ IL_0132: ldloca.s V_16
+ IL_0134: ldc.i4.1
+ IL_0135: call instance void valuetype Gen<class RefX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_013a: ldloca.s V_17
+ IL_013c: initobj valuetype Gen<class RefX2<float64,float64>[0...,0...]>
+ IL_0142: ldloc.s V_17
+ IL_0144: stloc.s V_17
+ IL_0146: ldloca.s V_17
+ IL_0148: ldc.i4.1
+ IL_0149: call instance void valuetype Gen<class RefX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_014e: ldloca.s V_18
+ IL_0150: initobj valuetype Gen<class RefX2<string,string>[][][]>
+ IL_0156: ldloc.s V_18
+ IL_0158: stloc.s V_18
+ IL_015a: ldloca.s V_18
+ IL_015c: ldc.i4.1
+ IL_015d: call instance void valuetype Gen<class RefX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_0162: ldloca.s V_19
+ IL_0164: initobj valuetype Gen<class RefX2<object,object>[0...,0...,0...,0...]>
+ IL_016a: ldloc.s V_19
+ IL_016c: stloc.s V_19
+ IL_016e: ldloca.s V_19
+ IL_0170: ldc.i4.1
+ IL_0171: call instance void valuetype Gen<class RefX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0176: ldloca.s V_20
+ IL_0178: initobj valuetype Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_017e: ldloc.s V_20
+ IL_0180: stloc.s V_20
+ IL_0182: ldloca.s V_20
+ IL_0184: ldc.i4.1
+ IL_0185: call instance void valuetype Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_018a: ldloca.s V_21
+ IL_018c: initobj valuetype Gen<valuetype ValX1<int32>[]>
+ IL_0192: ldloc.s V_21
+ IL_0194: stloc.s V_21
+ IL_0196: ldloca.s V_21
+ IL_0198: ldc.i4.1
+ IL_0199: call instance void valuetype Gen<valuetype ValX1<int32>[]>::ExceptionTest(bool)
+ IL_019e: ldloca.s V_22
+ IL_01a0: initobj valuetype Gen<valuetype ValX1<float64>[0...,0...]>
+ IL_01a6: ldloc.s V_22
+ IL_01a8: stloc.s V_22
+ IL_01aa: ldloca.s V_22
+ IL_01ac: ldc.i4.1
+ IL_01ad: call instance void valuetype Gen<valuetype ValX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_01b2: ldloca.s V_23
+ IL_01b4: initobj valuetype Gen<valuetype ValX1<string>[][][]>
+ IL_01ba: ldloc.s V_23
+ IL_01bc: stloc.s V_23
+ IL_01be: ldloca.s V_23
+ IL_01c0: ldc.i4.1
+ IL_01c1: call instance void valuetype Gen<valuetype ValX1<string>[][][]>::ExceptionTest(bool)
+ IL_01c6: ldloca.s V_24
+ IL_01c8: initobj valuetype Gen<valuetype ValX1<object>[0...,0...,0...,0...]>
+ IL_01ce: ldloc.s V_24
+ IL_01d0: stloc.s V_24
+ IL_01d2: ldloca.s V_24
+ IL_01d4: ldc.i4.1
+ IL_01d5: call instance void valuetype Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_01da: ldloca.s V_25
+ IL_01dc: initobj valuetype Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_01e2: ldloc.s V_25
+ IL_01e4: stloc.s V_25
+ IL_01e6: ldloca.s V_25
+ IL_01e8: ldc.i4.1
+ IL_01e9: call instance void valuetype Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_01ee: ldloca.s V_26
+ IL_01f0: initobj valuetype Gen<valuetype ValX2<int32,int32>[]>
+ IL_01f6: ldloc.s V_26
+ IL_01f8: stloc.s V_26
+ IL_01fa: ldloca.s V_26
+ IL_01fc: ldc.i4.1
+ IL_01fd: call instance void valuetype Gen<valuetype ValX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_0202: ldloca.s V_27
+ IL_0204: initobj valuetype Gen<valuetype ValX2<float64,float64>[0...,0...]>
+ IL_020a: ldloc.s V_27
+ IL_020c: stloc.s V_27
+ IL_020e: ldloca.s V_27
+ IL_0210: ldc.i4.1
+ IL_0211: call instance void valuetype Gen<valuetype ValX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0216: ldloca.s V_28
+ IL_0218: initobj valuetype Gen<valuetype ValX2<string,string>[][][]>
+ IL_021e: ldloc.s V_28
+ IL_0220: stloc.s V_28
+ IL_0222: ldloca.s V_28
+ IL_0224: ldc.i4.1
+ IL_0225: call instance void valuetype Gen<valuetype ValX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_022a: ldloca.s V_29
+ IL_022c: initobj valuetype Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>
+ IL_0232: ldloc.s V_29
+ IL_0234: stloc.s V_29
+ IL_0236: ldloca.s V_29
+ IL_0238: ldc.i4.1
+ IL_0239: call instance void valuetype Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_023e: ldloca.s V_30
+ IL_0240: initobj valuetype Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_0246: ldloc.s V_30
+ IL_0248: stloc.s V_30
+ IL_024a: ldloca.s V_30
+ IL_024c: ldc.i4.1
+ IL_024d: call instance void valuetype Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_0252: ldloca.s V_31
+ IL_0254: initobj valuetype Gen<class RefX1<int32>>
+ IL_025a: ldloc.s V_31
+ IL_025c: stloc.s V_31
+ IL_025e: ldloca.s V_31
+ IL_0260: ldc.i4.1
+ IL_0261: call instance void valuetype Gen<class RefX1<int32>>::ExceptionTest(bool)
+ IL_0266: ldloca.s V_32
+ IL_0268: initobj valuetype Gen<class RefX1<valuetype ValX1<int32>>>
+ IL_026e: ldloc.s V_32
+ IL_0270: stloc.s V_32
+ IL_0272: ldloca.s V_32
+ IL_0274: ldc.i4.1
+ IL_0275: call instance void valuetype Gen<class RefX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_027a: ldloca.s V_33
+ IL_027c: initobj valuetype Gen<class RefX2<int32,string>>
+ IL_0282: ldloc.s V_33
+ IL_0284: stloc.s V_33
+ IL_0286: ldloca.s V_33
+ IL_0288: ldc.i4.1
+ IL_0289: call instance void valuetype Gen<class RefX2<int32,string>>::ExceptionTest(bool)
+ IL_028e: ldloca.s V_34
+ IL_0290: initobj valuetype Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>
+ IL_0296: ldloc.s V_34
+ IL_0298: stloc.s V_34
+ IL_029a: ldloca.s V_34
+ IL_029c: ldc.i4.1
+ IL_029d: call instance void valuetype Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_02a2: ldloca.s V_35
+ IL_02a4: initobj valuetype Gen<class RefX1<class RefX1<int32>>>
+ IL_02aa: ldloc.s V_35
+ IL_02ac: stloc.s V_35
+ IL_02ae: ldloca.s V_35
+ IL_02b0: ldc.i4.1
+ IL_02b1: call instance void valuetype Gen<class RefX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_02b6: ldloca.s V_36
+ IL_02b8: initobj valuetype Gen<class RefX1<class RefX1<class RefX1<string>>>>
+ IL_02be: ldloc.s V_36
+ IL_02c0: stloc.s V_36
+ IL_02c2: ldloca.s V_36
+ IL_02c4: ldc.i4.1
+ IL_02c5: call instance void valuetype Gen<class RefX1<class RefX1<class RefX1<string>>>>::ExceptionTest(bool)
+ IL_02ca: ldloca.s V_37
+ IL_02cc: initobj valuetype Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>
+ IL_02d2: ldloc.s V_37
+ IL_02d4: stloc.s V_37
+ IL_02d6: ldloca.s V_37
+ IL_02d8: ldc.i4.1
+ IL_02d9: call instance void valuetype Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_02de: ldloca.s V_38
+ IL_02e0: initobj valuetype Gen<class RefX1<class RefX2<int32,string>>>
+ IL_02e6: ldloc.s V_38
+ IL_02e8: stloc.s V_38
+ IL_02ea: ldloca.s V_38
+ IL_02ec: ldc.i4.1
+ IL_02ed: call instance void valuetype Gen<class RefX1<class RefX2<int32,string>>>::ExceptionTest(bool)
+ IL_02f2: ldloca.s V_39
+ IL_02f4: initobj valuetype Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>
+ IL_02fa: ldloc.s V_39
+ IL_02fc: stloc.s V_39
+ IL_02fe: ldloca.s V_39
+ IL_0300: ldc.i4.1
+ IL_0301: call instance void valuetype Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_0306: ldloca.s V_40
+ IL_0308: initobj valuetype Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>
+ IL_030e: ldloc.s V_40
+ IL_0310: stloc.s V_40
+ IL_0312: ldloca.s V_40
+ IL_0314: ldc.i4.1
+ IL_0315: call instance void valuetype Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_031a: ldloca.s V_41
+ IL_031c: initobj valuetype Gen<valuetype ValX1<int32>>
+ IL_0322: ldloc.s V_41
+ IL_0324: stloc.s V_41
+ IL_0326: ldloca.s V_41
+ IL_0328: ldc.i4.1
+ IL_0329: call instance void valuetype Gen<valuetype ValX1<int32>>::ExceptionTest(bool)
+ IL_032e: ldloca.s V_42
+ IL_0330: initobj valuetype Gen<valuetype ValX1<class RefX1<int32>>>
+ IL_0336: ldloc.s V_42
+ IL_0338: stloc.s V_42
+ IL_033a: ldloca.s V_42
+ IL_033c: ldc.i4.1
+ IL_033d: call instance void valuetype Gen<valuetype ValX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_0342: ldloca.s V_43
+ IL_0344: initobj valuetype Gen<valuetype ValX2<int32,string>>
+ IL_034a: ldloc.s V_43
+ IL_034c: stloc.s V_43
+ IL_034e: ldloca.s V_43
+ IL_0350: ldc.i4.1
+ IL_0351: call instance void valuetype Gen<valuetype ValX2<int32,string>>::ExceptionTest(bool)
+ IL_0356: ldloca.s V_44
+ IL_0358: initobj valuetype Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>
+ IL_035e: ldloc.s V_44
+ IL_0360: stloc.s V_44
+ IL_0362: ldloca.s V_44
+ IL_0364: ldc.i4.1
+ IL_0365: call instance void valuetype Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_036a: ldloca.s V_45
+ IL_036c: initobj valuetype Gen<valuetype ValX1<valuetype ValX1<int32>>>
+ IL_0372: ldloc.s V_45
+ IL_0374: stloc.s V_45
+ IL_0376: ldloca.s V_45
+ IL_0378: ldc.i4.1
+ IL_0379: call instance void valuetype Gen<valuetype ValX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_037e: ldloca.s V_46
+ IL_0380: initobj valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>
+ IL_0386: ldloc.s V_46
+ IL_0388: stloc.s V_46
+ IL_038a: ldloca.s V_46
+ IL_038c: ldc.i4.1
+ IL_038d: call instance void valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::ExceptionTest(bool)
+ IL_0392: ldloca.s V_47
+ IL_0394: initobj valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>
+ IL_039a: ldloc.s V_47
+ IL_039c: stloc.s V_47
+ IL_039e: ldloca.s V_47
+ IL_03a0: ldc.i4.1
+ IL_03a1: call instance void valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_03a6: ldloca.s V_48
+ IL_03a8: initobj valuetype Gen<valuetype ValX1<valuetype ValX2<int32,string>>>
+ IL_03ae: ldloc.s V_48
+ IL_03b0: stloc.s V_48
+ IL_03b2: ldloca.s V_48
+ IL_03b4: ldc.i4.1
+ IL_03b5: call instance void valuetype Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::ExceptionTest(bool)
+ IL_03ba: ldloca.s V_49
+ IL_03bc: initobj valuetype Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>
+ IL_03c2: ldloc.s V_49
+ IL_03c4: stloc.s V_49
+ IL_03c6: ldloca.s V_49
+ IL_03c8: ldc.i4.1
+ IL_03c9: call instance void valuetype Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_03ce: ldloca.s V_50
+ IL_03d0: initobj valuetype Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>
+ IL_03d6: ldloc.s V_50
+ IL_03d8: stloc.s V_50
+ IL_03da: ldloca.s V_50
+ IL_03dc: ldc.i4.1
+ IL_03dd: call instance void valuetype Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_03e2: ldsfld bool Test::result
+ IL_03e7: brfalse.s IL_03f8
+ IL_03e9: ldstr "Test Passed"
+ IL_03ee: call void [System.Console]System.Console::WriteLine(string)
+ IL_03f3: ldc.i4.s 100
+ IL_03f5: stloc.0
+ IL_03f6: br.s IL_0406
+ IL_03f8: ldstr "Test Failed"
+ IL_03fd: call void [System.Console]System.Console::WriteLine(string)
+ IL_0402: ldc.i4.1
+ IL_0403: stloc.0
+ IL_0404: br.s IL_0406
+ IL_0406: ldloc.0
+ IL_0407: ret
+} // end of method Test::Main
+
+ .method private hidebysig specialname rtspecialname static
+ void .cctor() cil managed
+ {
+ // Code size 13 (0xd)
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 Test::counter
+ IL_0006: ldc.i4.1
+ IL_0007: stsfld bool Test::result
+ IL_000c: ret
+ } // end of method Test::.cctor
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+} // end of class Test
+
+
+// =============================================================
+
+
+//*********** DISASSEMBLY COMPLETE ***********************
+// WARNING: Created Win32 resource file try-fault01.res
diff --git a/tests/src/baseservices/exceptions/generics/try-fault-struct01.ilproj b/tests/src/baseservices/exceptions/generics/try-fault-struct01.ilproj
new file mode 100644
index 0000000000..9720c2a068
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-fault-struct01.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="try-fault-struct01.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-fault-struct02.il b/tests/src/baseservices/exceptions/generics/try-fault-struct02.il
new file mode 100644
index 0000000000..d57f3bd26e
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-fault-struct02.il
@@ -0,0 +1,779 @@
+// 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.
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 1.2.2211.0
+// Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
+
+
+
+// Metadata version: v1.1.2211
+.assembly extern legacy library mscorlib {}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+.assembly 'try-finally01'
+{
+
+ // --- The following custom attribute is added automatically, do not uncomment -------
+ // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
+ // bool) = ( 01 00 00 01 00 00 )
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'try-finally01.exe'
+// MVID: {736049C4-A4DA-41B1-895D-B9E4A517BBE4}
+.imagebase 0x00400000
+.subsystem 0x00000003
+.file alignment 512
+.corflags 0x00000001
+// Image base: 0x02DB0000
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public sequential ansi sealed beforefieldinit ValX0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX0
+
+.class public sequential ansi sealed beforefieldinit ValY0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY0
+
+.class public sequential ansi sealed beforefieldinit ValX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX1
+
+.class public sequential ansi sealed beforefieldinit ValY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY1
+
+.class public sequential ansi sealed beforefieldinit ValX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX2
+
+.class public sequential ansi sealed beforefieldinit ValY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY2
+
+.class public sequential ansi sealed beforefieldinit ValX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX3
+
+.class public sequential ansi sealed beforefieldinit ValY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY3
+
+.class public auto ansi beforefieldinit RefX0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX0::.ctor
+
+} // end of class RefX0
+
+.class public auto ansi beforefieldinit RefY0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY0::.ctor
+
+} // end of class RefY0
+
+.class public auto ansi beforefieldinit RefX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX1::.ctor
+
+} // end of class RefX1
+
+.class public auto ansi beforefieldinit RefY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY1::.ctor
+
+} // end of class RefY1
+
+.class public auto ansi beforefieldinit RefX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX2::.ctor
+
+} // end of class RefX2
+
+.class public auto ansi beforefieldinit RefY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY2::.ctor
+
+} // end of class RefY2
+
+.class public auto ansi beforefieldinit RefX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX3::.ctor
+
+} // end of class RefX3
+
+.class public auto ansi beforefieldinit RefY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY3::.ctor
+
+} // end of class RefY3
+
+.class public auto ansi beforefieldinit GenException<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Exception
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Exception::.ctor()
+ IL_0006: ret
+ } // end of method GenException::.ctor
+
+} // end of class GenException
+
+.class public sequential ansi sealed beforefieldinit Gen<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .method public hidebysig instance void
+ InternalExceptionTest(bool throwException) cil managed
+ {
+ // Code size 53 (0x35)
+ .maxstack 2
+ .locals init (string V_0)
+ IL_0000: ldtoken class GenException<!0>
+ IL_0005: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ IL_000a: callvirt instance string [mscorlib]System.Type::ToString()
+ IL_000f: stloc.0
+ .try
+ {
+ IL_0010: ldarg.1
+ IL_0011: brfalse.s IL_0019
+
+ IL_0013: newobj instance void class GenException<!0>::.ctor()
+ IL_0018: throw
+
+ IL_0019: ldarg.1
+ IL_001a: ldc.i4.0
+ IL_001b: ceq
+ IL_001d: call void Test::Eval(bool)
+ IL_0022: leave.s IL_002b
+
+ } // end .try
+ fault
+ {
+ IL_0024: ldarg.1
+ IL_0025: call void Test::Eval(bool)
+ IL_002a: endfault
+ } // end handler
+ IL_002b: ldarg.1
+ IL_002c: ldc.i4.0
+ IL_002d: ceq
+ IL_002f: call void Test::Eval(bool)
+ IL_0034: ret
+ } // end of method Gen::InternalExceptionTest
+
+ .method public hidebysig instance void
+ ExceptionTest(bool throwException) cil managed
+ {
+ // Code size 28 (0x1c)
+ .maxstack 2
+ .try
+ {
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: call instance void valuetype Gen<!0>::InternalExceptionTest(bool)
+ IL_0007: ldarg.1
+ IL_0008: ldc.i4.0
+ IL_0009: ceq
+ IL_000b: call void Test::Eval(bool)
+ IL_0010: leave.s IL_001b
+
+ } // end .try
+ catch [mscorlib]System.Object
+ {
+ IL_0012: pop
+ IL_0013: ldarg.1
+ IL_0014: call void Test::Eval(bool)
+ IL_0019: leave.s IL_001b
+
+ } // end handler
+ IL_001b: ret
+ } // end of method Gen::ExceptionTest
+
+} // end of class Gen
+
+.class public auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+{
+ .field public static int32 counter
+ .field public static bool result
+ .method public hidebysig static void Eval(bool exp) cil managed
+ {
+ // Code size 47 (0x2f)
+ .maxstack 8
+ IL_0000: ldsfld int32 Test::counter
+ IL_0005: ldc.i4.1
+ IL_0006: add
+ IL_0007: stsfld int32 Test::counter
+ IL_000c: ldarg.0
+ IL_000d: brtrue.s IL_002e
+
+ IL_000f: ldarg.0
+ IL_0010: stsfld bool Test::result
+ IL_0015: ldstr "Test Failed at location: "
+ IL_001a: ldsfld int32 Test::counter
+ IL_001f: box [mscorlib]System.Int32
+ IL_0024: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0029: call void [System.Console]System.Console::WriteLine(string)
+ IL_002e: ret
+ } // end of method Test::Eval
+
+.method public hidebysig static int32 Main() cil managed
+{
+ .entrypoint
+ // Code size 1032 (0x408)
+ .maxstack 2
+ .locals init (int32 V_0,
+ valuetype Gen<int32> V_1,
+ valuetype Gen<float64> V_2,
+ valuetype Gen<string> V_3,
+ valuetype Gen<object> V_4,
+ valuetype Gen<valuetype [mscorlib]System.Guid> V_5,
+ valuetype Gen<int32[]> V_6,
+ valuetype Gen<float64[0...,0...]> V_7,
+ valuetype Gen<string[][][]> V_8,
+ valuetype Gen<object[0...,0...,0...,0...]> V_9,
+ valuetype Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]> V_10,
+ valuetype Gen<class RefX1<int32>[]> V_11,
+ valuetype Gen<class RefX1<float64>[0...,0...]> V_12,
+ valuetype Gen<class RefX1<string>[][][]> V_13,
+ valuetype Gen<class RefX1<object>[0...,0...,0...,0...]> V_14,
+ valuetype Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_15,
+ valuetype Gen<class RefX2<int32,int32>[]> V_16,
+ valuetype Gen<class RefX2<float64,float64>[0...,0...]> V_17,
+ valuetype Gen<class RefX2<string,string>[][][]> V_18,
+ valuetype Gen<class RefX2<object,object>[0...,0...,0...,0...]> V_19,
+ valuetype Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_20,
+ valuetype Gen<valuetype ValX1<int32>[]> V_21,
+ valuetype Gen<valuetype ValX1<float64>[0...,0...]> V_22,
+ valuetype Gen<valuetype ValX1<string>[][][]> V_23,
+ valuetype Gen<valuetype ValX1<object>[0...,0...,0...,0...]> V_24,
+ valuetype Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_25,
+ valuetype Gen<valuetype ValX2<int32,int32>[]> V_26,
+ valuetype Gen<valuetype ValX2<float64,float64>[0...,0...]> V_27,
+ valuetype Gen<valuetype ValX2<string,string>[][][]> V_28,
+ valuetype Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]> V_29,
+ valuetype Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_30,
+ valuetype Gen<class RefX1<int32>> V_31,
+ valuetype Gen<class RefX1<valuetype ValX1<int32>>> V_32,
+ valuetype Gen<class RefX2<int32,string>> V_33,
+ valuetype Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>> V_34,
+ valuetype Gen<class RefX1<class RefX1<int32>>> V_35,
+ valuetype Gen<class RefX1<class RefX1<class RefX1<string>>>> V_36,
+ valuetype Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>> V_37,
+ valuetype Gen<class RefX1<class RefX2<int32,string>>> V_38,
+ valuetype Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>> V_39,
+ valuetype Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>> V_40,
+ valuetype Gen<valuetype ValX1<int32>> V_41,
+ valuetype Gen<valuetype ValX1<class RefX1<int32>>> V_42,
+ valuetype Gen<valuetype ValX2<int32,string>> V_43,
+ valuetype Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>> V_44,
+ valuetype Gen<valuetype ValX1<valuetype ValX1<int32>>> V_45,
+ valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>> V_46,
+ valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>> V_47,
+ valuetype Gen<valuetype ValX1<valuetype ValX2<int32,string>>> V_48,
+ valuetype Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>> V_49,
+ valuetype Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>> V_50)
+ IL_0000: ldloca.s V_1
+ IL_0002: initobj valuetype Gen<int32>
+ IL_0008: ldloc.1
+ IL_0009: stloc.1
+ IL_000a: ldloca.s V_1
+ IL_000c: ldc.i4.0
+ IL_000d: call instance void valuetype Gen<int32>::ExceptionTest(bool)
+ IL_0012: ldloca.s V_2
+ IL_0014: initobj valuetype Gen<float64>
+ IL_001a: ldloc.2
+ IL_001b: stloc.2
+ IL_001c: ldloca.s V_2
+ IL_001e: ldc.i4.0
+ IL_001f: call instance void valuetype Gen<float64>::ExceptionTest(bool)
+ IL_0024: ldloca.s V_3
+ IL_0026: initobj valuetype Gen<string>
+ IL_002c: ldloc.3
+ IL_002d: stloc.3
+ IL_002e: ldloca.s V_3
+ IL_0030: ldc.i4.0
+ IL_0031: call instance void valuetype Gen<string>::ExceptionTest(bool)
+ IL_0036: ldloca.s V_4
+ IL_0038: initobj valuetype Gen<object>
+ IL_003e: ldloc.s V_4
+ IL_0040: stloc.s V_4
+ IL_0042: ldloca.s V_4
+ IL_0044: ldc.i4.0
+ IL_0045: call instance void valuetype Gen<object>::ExceptionTest(bool)
+ IL_004a: ldloca.s V_5
+ IL_004c: initobj valuetype Gen<valuetype [mscorlib]System.Guid>
+ IL_0052: ldloc.s V_5
+ IL_0054: stloc.s V_5
+ IL_0056: ldloca.s V_5
+ IL_0058: ldc.i4.0
+ IL_0059: call instance void valuetype Gen<valuetype [mscorlib]System.Guid>::ExceptionTest(bool)
+ IL_005e: ldloca.s V_6
+ IL_0060: initobj valuetype Gen<int32[]>
+ IL_0066: ldloc.s V_6
+ IL_0068: stloc.s V_6
+ IL_006a: ldloca.s V_6
+ IL_006c: ldc.i4.0
+ IL_006d: call instance void valuetype Gen<int32[]>::ExceptionTest(bool)
+ IL_0072: ldloca.s V_7
+ IL_0074: initobj valuetype Gen<float64[0...,0...]>
+ IL_007a: ldloc.s V_7
+ IL_007c: stloc.s V_7
+ IL_007e: ldloca.s V_7
+ IL_0080: ldc.i4.0
+ IL_0081: call instance void valuetype Gen<float64[0...,0...]>::ExceptionTest(bool)
+ IL_0086: ldloca.s V_8
+ IL_0088: initobj valuetype Gen<string[][][]>
+ IL_008e: ldloc.s V_8
+ IL_0090: stloc.s V_8
+ IL_0092: ldloca.s V_8
+ IL_0094: ldc.i4.0
+ IL_0095: call instance void valuetype Gen<string[][][]>::ExceptionTest(bool)
+ IL_009a: ldloca.s V_9
+ IL_009c: initobj valuetype Gen<object[0...,0...,0...,0...]>
+ IL_00a2: ldloc.s V_9
+ IL_00a4: stloc.s V_9
+ IL_00a6: ldloca.s V_9
+ IL_00a8: ldc.i4.0
+ IL_00a9: call instance void valuetype Gen<object[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_00ae: ldloca.s V_10
+ IL_00b0: initobj valuetype Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>
+ IL_00b6: ldloc.s V_10
+ IL_00b8: stloc.s V_10
+ IL_00ba: ldloca.s V_10
+ IL_00bc: ldc.i4.0
+ IL_00bd: call instance void valuetype Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00c2: ldloca.s V_11
+ IL_00c4: initobj valuetype Gen<class RefX1<int32>[]>
+ IL_00ca: ldloc.s V_11
+ IL_00cc: stloc.s V_11
+ IL_00ce: ldloca.s V_11
+ IL_00d0: ldc.i4.0
+ IL_00d1: call instance void valuetype Gen<class RefX1<int32>[]>::ExceptionTest(bool)
+ IL_00d6: ldloca.s V_12
+ IL_00d8: initobj valuetype Gen<class RefX1<float64>[0...,0...]>
+ IL_00de: ldloc.s V_12
+ IL_00e0: stloc.s V_12
+ IL_00e2: ldloca.s V_12
+ IL_00e4: ldc.i4.0
+ IL_00e5: call instance void valuetype Gen<class RefX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00ea: ldloca.s V_13
+ IL_00ec: initobj valuetype Gen<class RefX1<string>[][][]>
+ IL_00f2: ldloc.s V_13
+ IL_00f4: stloc.s V_13
+ IL_00f6: ldloca.s V_13
+ IL_00f8: ldc.i4.0
+ IL_00f9: call instance void valuetype Gen<class RefX1<string>[][][]>::ExceptionTest(bool)
+ IL_00fe: ldloca.s V_14
+ IL_0100: initobj valuetype Gen<class RefX1<object>[0...,0...,0...,0...]>
+ IL_0106: ldloc.s V_14
+ IL_0108: stloc.s V_14
+ IL_010a: ldloca.s V_14
+ IL_010c: ldc.i4.0
+ IL_010d: call instance void valuetype Gen<class RefX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0112: ldloca.s V_15
+ IL_0114: initobj valuetype Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_011a: ldloc.s V_15
+ IL_011c: stloc.s V_15
+ IL_011e: ldloca.s V_15
+ IL_0120: ldc.i4.0
+ IL_0121: call instance void valuetype Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_0126: ldloca.s V_16
+ IL_0128: initobj valuetype Gen<class RefX2<int32,int32>[]>
+ IL_012e: ldloc.s V_16
+ IL_0130: stloc.s V_16
+ IL_0132: ldloca.s V_16
+ IL_0134: ldc.i4.0
+ IL_0135: call instance void valuetype Gen<class RefX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_013a: ldloca.s V_17
+ IL_013c: initobj valuetype Gen<class RefX2<float64,float64>[0...,0...]>
+ IL_0142: ldloc.s V_17
+ IL_0144: stloc.s V_17
+ IL_0146: ldloca.s V_17
+ IL_0148: ldc.i4.0
+ IL_0149: call instance void valuetype Gen<class RefX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_014e: ldloca.s V_18
+ IL_0150: initobj valuetype Gen<class RefX2<string,string>[][][]>
+ IL_0156: ldloc.s V_18
+ IL_0158: stloc.s V_18
+ IL_015a: ldloca.s V_18
+ IL_015c: ldc.i4.0
+ IL_015d: call instance void valuetype Gen<class RefX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_0162: ldloca.s V_19
+ IL_0164: initobj valuetype Gen<class RefX2<object,object>[0...,0...,0...,0...]>
+ IL_016a: ldloc.s V_19
+ IL_016c: stloc.s V_19
+ IL_016e: ldloca.s V_19
+ IL_0170: ldc.i4.0
+ IL_0171: call instance void valuetype Gen<class RefX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0176: ldloca.s V_20
+ IL_0178: initobj valuetype Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_017e: ldloc.s V_20
+ IL_0180: stloc.s V_20
+ IL_0182: ldloca.s V_20
+ IL_0184: ldc.i4.0
+ IL_0185: call instance void valuetype Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_018a: ldloca.s V_21
+ IL_018c: initobj valuetype Gen<valuetype ValX1<int32>[]>
+ IL_0192: ldloc.s V_21
+ IL_0194: stloc.s V_21
+ IL_0196: ldloca.s V_21
+ IL_0198: ldc.i4.0
+ IL_0199: call instance void valuetype Gen<valuetype ValX1<int32>[]>::ExceptionTest(bool)
+ IL_019e: ldloca.s V_22
+ IL_01a0: initobj valuetype Gen<valuetype ValX1<float64>[0...,0...]>
+ IL_01a6: ldloc.s V_22
+ IL_01a8: stloc.s V_22
+ IL_01aa: ldloca.s V_22
+ IL_01ac: ldc.i4.0
+ IL_01ad: call instance void valuetype Gen<valuetype ValX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_01b2: ldloca.s V_23
+ IL_01b4: initobj valuetype Gen<valuetype ValX1<string>[][][]>
+ IL_01ba: ldloc.s V_23
+ IL_01bc: stloc.s V_23
+ IL_01be: ldloca.s V_23
+ IL_01c0: ldc.i4.0
+ IL_01c1: call instance void valuetype Gen<valuetype ValX1<string>[][][]>::ExceptionTest(bool)
+ IL_01c6: ldloca.s V_24
+ IL_01c8: initobj valuetype Gen<valuetype ValX1<object>[0...,0...,0...,0...]>
+ IL_01ce: ldloc.s V_24
+ IL_01d0: stloc.s V_24
+ IL_01d2: ldloca.s V_24
+ IL_01d4: ldc.i4.0
+ IL_01d5: call instance void valuetype Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_01da: ldloca.s V_25
+ IL_01dc: initobj valuetype Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_01e2: ldloc.s V_25
+ IL_01e4: stloc.s V_25
+ IL_01e6: ldloca.s V_25
+ IL_01e8: ldc.i4.0
+ IL_01e9: call instance void valuetype Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_01ee: ldloca.s V_26
+ IL_01f0: initobj valuetype Gen<valuetype ValX2<int32,int32>[]>
+ IL_01f6: ldloc.s V_26
+ IL_01f8: stloc.s V_26
+ IL_01fa: ldloca.s V_26
+ IL_01fc: ldc.i4.0
+ IL_01fd: call instance void valuetype Gen<valuetype ValX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_0202: ldloca.s V_27
+ IL_0204: initobj valuetype Gen<valuetype ValX2<float64,float64>[0...,0...]>
+ IL_020a: ldloc.s V_27
+ IL_020c: stloc.s V_27
+ IL_020e: ldloca.s V_27
+ IL_0210: ldc.i4.0
+ IL_0211: call instance void valuetype Gen<valuetype ValX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0216: ldloca.s V_28
+ IL_0218: initobj valuetype Gen<valuetype ValX2<string,string>[][][]>
+ IL_021e: ldloc.s V_28
+ IL_0220: stloc.s V_28
+ IL_0222: ldloca.s V_28
+ IL_0224: ldc.i4.0
+ IL_0225: call instance void valuetype Gen<valuetype ValX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_022a: ldloca.s V_29
+ IL_022c: initobj valuetype Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>
+ IL_0232: ldloc.s V_29
+ IL_0234: stloc.s V_29
+ IL_0236: ldloca.s V_29
+ IL_0238: ldc.i4.0
+ IL_0239: call instance void valuetype Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_023e: ldloca.s V_30
+ IL_0240: initobj valuetype Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_0246: ldloc.s V_30
+ IL_0248: stloc.s V_30
+ IL_024a: ldloca.s V_30
+ IL_024c: ldc.i4.0
+ IL_024d: call instance void valuetype Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_0252: ldloca.s V_31
+ IL_0254: initobj valuetype Gen<class RefX1<int32>>
+ IL_025a: ldloc.s V_31
+ IL_025c: stloc.s V_31
+ IL_025e: ldloca.s V_31
+ IL_0260: ldc.i4.0
+ IL_0261: call instance void valuetype Gen<class RefX1<int32>>::ExceptionTest(bool)
+ IL_0266: ldloca.s V_32
+ IL_0268: initobj valuetype Gen<class RefX1<valuetype ValX1<int32>>>
+ IL_026e: ldloc.s V_32
+ IL_0270: stloc.s V_32
+ IL_0272: ldloca.s V_32
+ IL_0274: ldc.i4.0
+ IL_0275: call instance void valuetype Gen<class RefX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_027a: ldloca.s V_33
+ IL_027c: initobj valuetype Gen<class RefX2<int32,string>>
+ IL_0282: ldloc.s V_33
+ IL_0284: stloc.s V_33
+ IL_0286: ldloca.s V_33
+ IL_0288: ldc.i4.0
+ IL_0289: call instance void valuetype Gen<class RefX2<int32,string>>::ExceptionTest(bool)
+ IL_028e: ldloca.s V_34
+ IL_0290: initobj valuetype Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>
+ IL_0296: ldloc.s V_34
+ IL_0298: stloc.s V_34
+ IL_029a: ldloca.s V_34
+ IL_029c: ldc.i4.0
+ IL_029d: call instance void valuetype Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_02a2: ldloca.s V_35
+ IL_02a4: initobj valuetype Gen<class RefX1<class RefX1<int32>>>
+ IL_02aa: ldloc.s V_35
+ IL_02ac: stloc.s V_35
+ IL_02ae: ldloca.s V_35
+ IL_02b0: ldc.i4.0
+ IL_02b1: call instance void valuetype Gen<class RefX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_02b6: ldloca.s V_36
+ IL_02b8: initobj valuetype Gen<class RefX1<class RefX1<class RefX1<string>>>>
+ IL_02be: ldloc.s V_36
+ IL_02c0: stloc.s V_36
+ IL_02c2: ldloca.s V_36
+ IL_02c4: ldc.i4.0
+ IL_02c5: call instance void valuetype Gen<class RefX1<class RefX1<class RefX1<string>>>>::ExceptionTest(bool)
+ IL_02ca: ldloca.s V_37
+ IL_02cc: initobj valuetype Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>
+ IL_02d2: ldloc.s V_37
+ IL_02d4: stloc.s V_37
+ IL_02d6: ldloca.s V_37
+ IL_02d8: ldc.i4.0
+ IL_02d9: call instance void valuetype Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_02de: ldloca.s V_38
+ IL_02e0: initobj valuetype Gen<class RefX1<class RefX2<int32,string>>>
+ IL_02e6: ldloc.s V_38
+ IL_02e8: stloc.s V_38
+ IL_02ea: ldloca.s V_38
+ IL_02ec: ldc.i4.0
+ IL_02ed: call instance void valuetype Gen<class RefX1<class RefX2<int32,string>>>::ExceptionTest(bool)
+ IL_02f2: ldloca.s V_39
+ IL_02f4: initobj valuetype Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>
+ IL_02fa: ldloc.s V_39
+ IL_02fc: stloc.s V_39
+ IL_02fe: ldloca.s V_39
+ IL_0300: ldc.i4.0
+ IL_0301: call instance void valuetype Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_0306: ldloca.s V_40
+ IL_0308: initobj valuetype Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>
+ IL_030e: ldloc.s V_40
+ IL_0310: stloc.s V_40
+ IL_0312: ldloca.s V_40
+ IL_0314: ldc.i4.0
+ IL_0315: call instance void valuetype Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_031a: ldloca.s V_41
+ IL_031c: initobj valuetype Gen<valuetype ValX1<int32>>
+ IL_0322: ldloc.s V_41
+ IL_0324: stloc.s V_41
+ IL_0326: ldloca.s V_41
+ IL_0328: ldc.i4.0
+ IL_0329: call instance void valuetype Gen<valuetype ValX1<int32>>::ExceptionTest(bool)
+ IL_032e: ldloca.s V_42
+ IL_0330: initobj valuetype Gen<valuetype ValX1<class RefX1<int32>>>
+ IL_0336: ldloc.s V_42
+ IL_0338: stloc.s V_42
+ IL_033a: ldloca.s V_42
+ IL_033c: ldc.i4.0
+ IL_033d: call instance void valuetype Gen<valuetype ValX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_0342: ldloca.s V_43
+ IL_0344: initobj valuetype Gen<valuetype ValX2<int32,string>>
+ IL_034a: ldloc.s V_43
+ IL_034c: stloc.s V_43
+ IL_034e: ldloca.s V_43
+ IL_0350: ldc.i4.0
+ IL_0351: call instance void valuetype Gen<valuetype ValX2<int32,string>>::ExceptionTest(bool)
+ IL_0356: ldloca.s V_44
+ IL_0358: initobj valuetype Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>
+ IL_035e: ldloc.s V_44
+ IL_0360: stloc.s V_44
+ IL_0362: ldloca.s V_44
+ IL_0364: ldc.i4.0
+ IL_0365: call instance void valuetype Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_036a: ldloca.s V_45
+ IL_036c: initobj valuetype Gen<valuetype ValX1<valuetype ValX1<int32>>>
+ IL_0372: ldloc.s V_45
+ IL_0374: stloc.s V_45
+ IL_0376: ldloca.s V_45
+ IL_0378: ldc.i4.0
+ IL_0379: call instance void valuetype Gen<valuetype ValX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_037e: ldloca.s V_46
+ IL_0380: initobj valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>
+ IL_0386: ldloc.s V_46
+ IL_0388: stloc.s V_46
+ IL_038a: ldloca.s V_46
+ IL_038c: ldc.i4.0
+ IL_038d: call instance void valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::ExceptionTest(bool)
+ IL_0392: ldloca.s V_47
+ IL_0394: initobj valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>
+ IL_039a: ldloc.s V_47
+ IL_039c: stloc.s V_47
+ IL_039e: ldloca.s V_47
+ IL_03a0: ldc.i4.0
+ IL_03a1: call instance void valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_03a6: ldloca.s V_48
+ IL_03a8: initobj valuetype Gen<valuetype ValX1<valuetype ValX2<int32,string>>>
+ IL_03ae: ldloc.s V_48
+ IL_03b0: stloc.s V_48
+ IL_03b2: ldloca.s V_48
+ IL_03b4: ldc.i4.0
+ IL_03b5: call instance void valuetype Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::ExceptionTest(bool)
+ IL_03ba: ldloca.s V_49
+ IL_03bc: initobj valuetype Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>
+ IL_03c2: ldloc.s V_49
+ IL_03c4: stloc.s V_49
+ IL_03c6: ldloca.s V_49
+ IL_03c8: ldc.i4.0
+ IL_03c9: call instance void valuetype Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_03ce: ldloca.s V_50
+ IL_03d0: initobj valuetype Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>
+ IL_03d6: ldloc.s V_50
+ IL_03d8: stloc.s V_50
+ IL_03da: ldloca.s V_50
+ IL_03dc: ldc.i4.0
+ IL_03dd: call instance void valuetype Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_03e2: ldsfld bool Test::result
+ IL_03e7: brfalse.s IL_03f8
+ IL_03e9: ldstr "Test Passed"
+ IL_03ee: call void [System.Console]System.Console::WriteLine(string)
+ IL_03f3: ldc.i4.s 100
+ IL_03f5: stloc.0
+ IL_03f6: br.s IL_0406
+ IL_03f8: ldstr "Test Failed"
+ IL_03fd: call void [System.Console]System.Console::WriteLine(string)
+ IL_0402: ldc.i4.1
+ IL_0403: stloc.0
+ IL_0404: br.s IL_0406
+ IL_0406: ldloc.0
+ IL_0407: ret
+} // end of method Test::Main
+
+
+
+ .method private hidebysig specialname rtspecialname static
+ void .cctor() cil managed
+ {
+ // Code size 13 (0xd)
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 Test::counter
+ IL_0006: ldc.i4.1
+ IL_0007: stsfld bool Test::result
+ IL_000c: ret
+ } // end of method Test::.cctor
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+} // end of class Test
+
+
+// =============================================================
+
+
+//*********** DISASSEMBLY COMPLETE ***********************
+// WARNING: Created Win32 resource file try-fault02.res
diff --git a/tests/src/baseservices/exceptions/generics/try-fault-struct02.ilproj b/tests/src/baseservices/exceptions/generics/try-fault-struct02.ilproj
new file mode 100644
index 0000000000..e74165eb89
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-fault-struct02.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="try-fault-struct02.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-fault-struct03.il b/tests/src/baseservices/exceptions/generics/try-fault-struct03.il
new file mode 100644
index 0000000000..9f9d662dfc
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-fault-struct03.il
@@ -0,0 +1,780 @@
+// 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.
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 1.2.2211.0
+// Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
+
+
+
+// Metadata version: v1.1.2211
+.assembly extern legacy library mscorlib {}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+.assembly 'try-fault-struct03'
+{
+
+ // --- The following custom attribute is added automatically, do not uncomment -------
+ // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
+ // bool) = ( 01 00 00 01 00 00 )
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'try-fault-struct03.exe'
+// MVID: {64D27B72-3BAB-4B06-AC5B-6ECC5A9F3FB9}
+.imagebase 0x00400000
+.subsystem 0x00000003
+.file alignment 512
+.corflags 0x00000001
+// Image base: 0x02DB0000
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public sequential ansi sealed beforefieldinit ValX0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX0
+
+.class public sequential ansi sealed beforefieldinit ValY0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY0
+
+.class public sequential ansi sealed beforefieldinit ValX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX1
+
+.class public sequential ansi sealed beforefieldinit ValY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY1
+
+.class public sequential ansi sealed beforefieldinit ValX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX2
+
+.class public sequential ansi sealed beforefieldinit ValY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY2
+
+.class public sequential ansi sealed beforefieldinit ValX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX3
+
+.class public sequential ansi sealed beforefieldinit ValY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY3
+
+.class public auto ansi beforefieldinit RefX0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX0::.ctor
+
+} // end of class RefX0
+
+.class public auto ansi beforefieldinit RefY0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY0::.ctor
+
+} // end of class RefY0
+
+.class public auto ansi beforefieldinit RefX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX1::.ctor
+
+} // end of class RefX1
+
+.class public auto ansi beforefieldinit RefY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY1::.ctor
+
+} // end of class RefY1
+
+.class public auto ansi beforefieldinit RefX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX2::.ctor
+
+} // end of class RefX2
+
+.class public auto ansi beforefieldinit RefY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY2::.ctor
+
+} // end of class RefY2
+
+.class public auto ansi beforefieldinit RefX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX3::.ctor
+
+} // end of class RefX3
+
+.class public auto ansi beforefieldinit RefY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY3::.ctor
+
+} // end of class RefY3
+
+.class public auto ansi beforefieldinit GenException<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Exception
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Exception::.ctor()
+ IL_0006: ret
+ } // end of method GenException::.ctor
+
+} // end of class GenException
+
+.class public sequential ansi sealed beforefieldinit Gen<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .field public bool hit
+ .method public hidebysig instance void
+ InternalExceptionTest(bool throwException) cil managed
+ {
+ // Code size 42 (0x2a)
+ .maxstack 2
+ IL_0000: ldarg.0
+ IL_0001: ldc.i4.0
+ IL_0002: stfld bool valuetype Gen<!0>::hit
+ IL_0007: ldarg.1
+ IL_0008: brfalse.s IL_0010
+
+ IL_000a: newobj instance void class GenException<!0>::.ctor()
+ IL_000f: throw
+
+ IL_0010: ldarg.1
+ IL_0011: ldc.i4.0
+ IL_0012: ceq
+ IL_0014: call void Test::Eval(bool)
+ IL_0019: leave.s IL_0028
+
+ IL_001b: ldarg.0
+ IL_001c: ldc.i4.1
+ IL_001d: stfld bool valuetype Gen<!0>::hit
+ IL_0022: newobj instance void class GenException<class RefX1<!0>>::.ctor()
+ IL_0027: throw
+
+ IL_0028: br.s IL_0028
+ IL_002a:
+ // Exception count 1
+ .try IL_0007 to IL_001b fault handler IL_001b to IL_0028
+ } // end of method Gen::InternalExceptionTest
+
+ .method public hidebysig instance void
+ ExceptionTest(bool throwException) cil managed
+ {
+ // Code size 53 (0x35)
+ .maxstack 2
+ .locals init (class [mscorlib]System.Exception V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: call instance void valuetype Gen<!0>::InternalExceptionTest(bool)
+ IL_0007: ldarg.1
+ IL_0008: ldc.i4.0
+ IL_0009: ceq
+ IL_000b: call void Test::Eval(bool)
+ IL_0010: leave.s IL_0034
+
+ IL_0012: stloc.0
+ IL_0013: ldarg.0
+ IL_0014: ldfld bool valuetype Gen<!0>::hit
+ IL_0019: call void Test::Eval(bool)
+ IL_001e: ldarg.1
+ IL_001f: call void Test::Eval(bool)
+ IL_0024: ldloc.0
+ IL_0025: isinst class GenException<class RefX1<!0>>
+ IL_002a: ldnull
+ IL_002b: cgt.un
+ IL_002d: call void Test::Eval(bool)
+ IL_0032: leave.s IL_0034
+
+ IL_0034: ret
+ IL_0035:
+ // Exception count 1
+ .try IL_0000 to IL_0012 catch [mscorlib]System.Exception handler IL_0012 to IL_0034
+ } // end of method Gen::ExceptionTest
+
+} // end of valuetype Gen
+
+.class public auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+{
+ .field public static int32 counter
+ .field public static bool result
+ .method public hidebysig static void Eval(bool exp) cil managed
+ {
+ // Code size 47 (0x2f)
+ .maxstack 8
+ IL_0000: ldsfld int32 Test::counter
+ IL_0005: ldc.i4.1
+ IL_0006: add
+ IL_0007: stsfld int32 Test::counter
+ IL_000c: ldarg.0
+ IL_000d: brtrue.s IL_002e
+
+ IL_000f: ldarg.0
+ IL_0010: stsfld bool Test::result
+ IL_0015: ldstr "Test Failed at location: "
+ IL_001a: ldsfld int32 Test::counter
+ IL_001f: box [mscorlib]System.Int32
+ IL_0024: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0029: call void [System.Console]System.Console::WriteLine(string)
+ IL_002e: ret
+ } // end of method Test::Eval
+
+.method public hidebysig static int32 Main() cil managed
+{
+ .entrypoint
+ // Code size 1032 (0x408)
+ .maxstack 2
+ .locals init (int32 V_0,
+ valuetype Gen<int32> V_1,
+ valuetype Gen<float64> V_2,
+ valuetype Gen<string> V_3,
+ valuetype Gen<object> V_4,
+ valuetype Gen<valuetype [mscorlib]System.Guid> V_5,
+ valuetype Gen<int32[]> V_6,
+ valuetype Gen<float64[0...,0...]> V_7,
+ valuetype Gen<string[][][]> V_8,
+ valuetype Gen<object[0...,0...,0...,0...]> V_9,
+ valuetype Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]> V_10,
+ valuetype Gen<class RefX1<int32>[]> V_11,
+ valuetype Gen<class RefX1<float64>[0...,0...]> V_12,
+ valuetype Gen<class RefX1<string>[][][]> V_13,
+ valuetype Gen<class RefX1<object>[0...,0...,0...,0...]> V_14,
+ valuetype Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_15,
+ valuetype Gen<class RefX2<int32,int32>[]> V_16,
+ valuetype Gen<class RefX2<float64,float64>[0...,0...]> V_17,
+ valuetype Gen<class RefX2<string,string>[][][]> V_18,
+ valuetype Gen<class RefX2<object,object>[0...,0...,0...,0...]> V_19,
+ valuetype Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_20,
+ valuetype Gen<valuetype ValX1<int32>[]> V_21,
+ valuetype Gen<valuetype ValX1<float64>[0...,0...]> V_22,
+ valuetype Gen<valuetype ValX1<string>[][][]> V_23,
+ valuetype Gen<valuetype ValX1<object>[0...,0...,0...,0...]> V_24,
+ valuetype Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_25,
+ valuetype Gen<valuetype ValX2<int32,int32>[]> V_26,
+ valuetype Gen<valuetype ValX2<float64,float64>[0...,0...]> V_27,
+ valuetype Gen<valuetype ValX2<string,string>[][][]> V_28,
+ valuetype Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]> V_29,
+ valuetype Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_30,
+ valuetype Gen<class RefX1<int32>> V_31,
+ valuetype Gen<class RefX1<valuetype ValX1<int32>>> V_32,
+ valuetype Gen<class RefX2<int32,string>> V_33,
+ valuetype Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>> V_34,
+ valuetype Gen<class RefX1<class RefX1<int32>>> V_35,
+ valuetype Gen<class RefX1<class RefX1<class RefX1<string>>>> V_36,
+ valuetype Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>> V_37,
+ valuetype Gen<class RefX1<class RefX2<int32,string>>> V_38,
+ valuetype Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>> V_39,
+ valuetype Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>> V_40,
+ valuetype Gen<valuetype ValX1<int32>> V_41,
+ valuetype Gen<valuetype ValX1<class RefX1<int32>>> V_42,
+ valuetype Gen<valuetype ValX2<int32,string>> V_43,
+ valuetype Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>> V_44,
+ valuetype Gen<valuetype ValX1<valuetype ValX1<int32>>> V_45,
+ valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>> V_46,
+ valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>> V_47,
+ valuetype Gen<valuetype ValX1<valuetype ValX2<int32,string>>> V_48,
+ valuetype Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>> V_49,
+ valuetype Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>> V_50)
+ IL_0000: ldloca.s V_1
+ IL_0002: initobj valuetype Gen<int32>
+ IL_0008: ldloc.1
+ IL_0009: stloc.1
+ IL_000a: ldloca.s V_1
+ IL_000c: ldc.i4.1
+ IL_000d: call instance void valuetype Gen<int32>::ExceptionTest(bool)
+ IL_0012: ldloca.s V_2
+ IL_0014: initobj valuetype Gen<float64>
+ IL_001a: ldloc.2
+ IL_001b: stloc.2
+ IL_001c: ldloca.s V_2
+ IL_001e: ldc.i4.1
+ IL_001f: call instance void valuetype Gen<float64>::ExceptionTest(bool)
+ IL_0024: ldloca.s V_3
+ IL_0026: initobj valuetype Gen<string>
+ IL_002c: ldloc.3
+ IL_002d: stloc.3
+ IL_002e: ldloca.s V_3
+ IL_0030: ldc.i4.1
+ IL_0031: call instance void valuetype Gen<string>::ExceptionTest(bool)
+ IL_0036: ldloca.s V_4
+ IL_0038: initobj valuetype Gen<object>
+ IL_003e: ldloc.s V_4
+ IL_0040: stloc.s V_4
+ IL_0042: ldloca.s V_4
+ IL_0044: ldc.i4.1
+ IL_0045: call instance void valuetype Gen<object>::ExceptionTest(bool)
+ IL_004a: ldloca.s V_5
+ IL_004c: initobj valuetype Gen<valuetype [mscorlib]System.Guid>
+ IL_0052: ldloc.s V_5
+ IL_0054: stloc.s V_5
+ IL_0056: ldloca.s V_5
+ IL_0058: ldc.i4.1
+ IL_0059: call instance void valuetype Gen<valuetype [mscorlib]System.Guid>::ExceptionTest(bool)
+ IL_005e: ldloca.s V_6
+ IL_0060: initobj valuetype Gen<int32[]>
+ IL_0066: ldloc.s V_6
+ IL_0068: stloc.s V_6
+ IL_006a: ldloca.s V_6
+ IL_006c: ldc.i4.1
+ IL_006d: call instance void valuetype Gen<int32[]>::ExceptionTest(bool)
+ IL_0072: ldloca.s V_7
+ IL_0074: initobj valuetype Gen<float64[0...,0...]>
+ IL_007a: ldloc.s V_7
+ IL_007c: stloc.s V_7
+ IL_007e: ldloca.s V_7
+ IL_0080: ldc.i4.1
+ IL_0081: call instance void valuetype Gen<float64[0...,0...]>::ExceptionTest(bool)
+ IL_0086: ldloca.s V_8
+ IL_0088: initobj valuetype Gen<string[][][]>
+ IL_008e: ldloc.s V_8
+ IL_0090: stloc.s V_8
+ IL_0092: ldloca.s V_8
+ IL_0094: ldc.i4.1
+ IL_0095: call instance void valuetype Gen<string[][][]>::ExceptionTest(bool)
+ IL_009a: ldloca.s V_9
+ IL_009c: initobj valuetype Gen<object[0...,0...,0...,0...]>
+ IL_00a2: ldloc.s V_9
+ IL_00a4: stloc.s V_9
+ IL_00a6: ldloca.s V_9
+ IL_00a8: ldc.i4.1
+ IL_00a9: call instance void valuetype Gen<object[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_00ae: ldloca.s V_10
+ IL_00b0: initobj valuetype Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>
+ IL_00b6: ldloc.s V_10
+ IL_00b8: stloc.s V_10
+ IL_00ba: ldloca.s V_10
+ IL_00bc: ldc.i4.1
+ IL_00bd: call instance void valuetype Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00c2: ldloca.s V_11
+ IL_00c4: initobj valuetype Gen<class RefX1<int32>[]>
+ IL_00ca: ldloc.s V_11
+ IL_00cc: stloc.s V_11
+ IL_00ce: ldloca.s V_11
+ IL_00d0: ldc.i4.1
+ IL_00d1: call instance void valuetype Gen<class RefX1<int32>[]>::ExceptionTest(bool)
+ IL_00d6: ldloca.s V_12
+ IL_00d8: initobj valuetype Gen<class RefX1<float64>[0...,0...]>
+ IL_00de: ldloc.s V_12
+ IL_00e0: stloc.s V_12
+ IL_00e2: ldloca.s V_12
+ IL_00e4: ldc.i4.1
+ IL_00e5: call instance void valuetype Gen<class RefX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00ea: ldloca.s V_13
+ IL_00ec: initobj valuetype Gen<class RefX1<string>[][][]>
+ IL_00f2: ldloc.s V_13
+ IL_00f4: stloc.s V_13
+ IL_00f6: ldloca.s V_13
+ IL_00f8: ldc.i4.1
+ IL_00f9: call instance void valuetype Gen<class RefX1<string>[][][]>::ExceptionTest(bool)
+ IL_00fe: ldloca.s V_14
+ IL_0100: initobj valuetype Gen<class RefX1<object>[0...,0...,0...,0...]>
+ IL_0106: ldloc.s V_14
+ IL_0108: stloc.s V_14
+ IL_010a: ldloca.s V_14
+ IL_010c: ldc.i4.1
+ IL_010d: call instance void valuetype Gen<class RefX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0112: ldloca.s V_15
+ IL_0114: initobj valuetype Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_011a: ldloc.s V_15
+ IL_011c: stloc.s V_15
+ IL_011e: ldloca.s V_15
+ IL_0120: ldc.i4.1
+ IL_0121: call instance void valuetype Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_0126: ldloca.s V_16
+ IL_0128: initobj valuetype Gen<class RefX2<int32,int32>[]>
+ IL_012e: ldloc.s V_16
+ IL_0130: stloc.s V_16
+ IL_0132: ldloca.s V_16
+ IL_0134: ldc.i4.1
+ IL_0135: call instance void valuetype Gen<class RefX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_013a: ldloca.s V_17
+ IL_013c: initobj valuetype Gen<class RefX2<float64,float64>[0...,0...]>
+ IL_0142: ldloc.s V_17
+ IL_0144: stloc.s V_17
+ IL_0146: ldloca.s V_17
+ IL_0148: ldc.i4.1
+ IL_0149: call instance void valuetype Gen<class RefX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_014e: ldloca.s V_18
+ IL_0150: initobj valuetype Gen<class RefX2<string,string>[][][]>
+ IL_0156: ldloc.s V_18
+ IL_0158: stloc.s V_18
+ IL_015a: ldloca.s V_18
+ IL_015c: ldc.i4.1
+ IL_015d: call instance void valuetype Gen<class RefX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_0162: ldloca.s V_19
+ IL_0164: initobj valuetype Gen<class RefX2<object,object>[0...,0...,0...,0...]>
+ IL_016a: ldloc.s V_19
+ IL_016c: stloc.s V_19
+ IL_016e: ldloca.s V_19
+ IL_0170: ldc.i4.1
+ IL_0171: call instance void valuetype Gen<class RefX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0176: ldloca.s V_20
+ IL_0178: initobj valuetype Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_017e: ldloc.s V_20
+ IL_0180: stloc.s V_20
+ IL_0182: ldloca.s V_20
+ IL_0184: ldc.i4.1
+ IL_0185: call instance void valuetype Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_018a: ldloca.s V_21
+ IL_018c: initobj valuetype Gen<valuetype ValX1<int32>[]>
+ IL_0192: ldloc.s V_21
+ IL_0194: stloc.s V_21
+ IL_0196: ldloca.s V_21
+ IL_0198: ldc.i4.1
+ IL_0199: call instance void valuetype Gen<valuetype ValX1<int32>[]>::ExceptionTest(bool)
+ IL_019e: ldloca.s V_22
+ IL_01a0: initobj valuetype Gen<valuetype ValX1<float64>[0...,0...]>
+ IL_01a6: ldloc.s V_22
+ IL_01a8: stloc.s V_22
+ IL_01aa: ldloca.s V_22
+ IL_01ac: ldc.i4.1
+ IL_01ad: call instance void valuetype Gen<valuetype ValX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_01b2: ldloca.s V_23
+ IL_01b4: initobj valuetype Gen<valuetype ValX1<string>[][][]>
+ IL_01ba: ldloc.s V_23
+ IL_01bc: stloc.s V_23
+ IL_01be: ldloca.s V_23
+ IL_01c0: ldc.i4.1
+ IL_01c1: call instance void valuetype Gen<valuetype ValX1<string>[][][]>::ExceptionTest(bool)
+ IL_01c6: ldloca.s V_24
+ IL_01c8: initobj valuetype Gen<valuetype ValX1<object>[0...,0...,0...,0...]>
+ IL_01ce: ldloc.s V_24
+ IL_01d0: stloc.s V_24
+ IL_01d2: ldloca.s V_24
+ IL_01d4: ldc.i4.1
+ IL_01d5: call instance void valuetype Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_01da: ldloca.s V_25
+ IL_01dc: initobj valuetype Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_01e2: ldloc.s V_25
+ IL_01e4: stloc.s V_25
+ IL_01e6: ldloca.s V_25
+ IL_01e8: ldc.i4.1
+ IL_01e9: call instance void valuetype Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_01ee: ldloca.s V_26
+ IL_01f0: initobj valuetype Gen<valuetype ValX2<int32,int32>[]>
+ IL_01f6: ldloc.s V_26
+ IL_01f8: stloc.s V_26
+ IL_01fa: ldloca.s V_26
+ IL_01fc: ldc.i4.1
+ IL_01fd: call instance void valuetype Gen<valuetype ValX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_0202: ldloca.s V_27
+ IL_0204: initobj valuetype Gen<valuetype ValX2<float64,float64>[0...,0...]>
+ IL_020a: ldloc.s V_27
+ IL_020c: stloc.s V_27
+ IL_020e: ldloca.s V_27
+ IL_0210: ldc.i4.1
+ IL_0211: call instance void valuetype Gen<valuetype ValX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0216: ldloca.s V_28
+ IL_0218: initobj valuetype Gen<valuetype ValX2<string,string>[][][]>
+ IL_021e: ldloc.s V_28
+ IL_0220: stloc.s V_28
+ IL_0222: ldloca.s V_28
+ IL_0224: ldc.i4.1
+ IL_0225: call instance void valuetype Gen<valuetype ValX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_022a: ldloca.s V_29
+ IL_022c: initobj valuetype Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>
+ IL_0232: ldloc.s V_29
+ IL_0234: stloc.s V_29
+ IL_0236: ldloca.s V_29
+ IL_0238: ldc.i4.1
+ IL_0239: call instance void valuetype Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_023e: ldloca.s V_30
+ IL_0240: initobj valuetype Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_0246: ldloc.s V_30
+ IL_0248: stloc.s V_30
+ IL_024a: ldloca.s V_30
+ IL_024c: ldc.i4.1
+ IL_024d: call instance void valuetype Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_0252: ldloca.s V_31
+ IL_0254: initobj valuetype Gen<class RefX1<int32>>
+ IL_025a: ldloc.s V_31
+ IL_025c: stloc.s V_31
+ IL_025e: ldloca.s V_31
+ IL_0260: ldc.i4.1
+ IL_0261: call instance void valuetype Gen<class RefX1<int32>>::ExceptionTest(bool)
+ IL_0266: ldloca.s V_32
+ IL_0268: initobj valuetype Gen<class RefX1<valuetype ValX1<int32>>>
+ IL_026e: ldloc.s V_32
+ IL_0270: stloc.s V_32
+ IL_0272: ldloca.s V_32
+ IL_0274: ldc.i4.1
+ IL_0275: call instance void valuetype Gen<class RefX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_027a: ldloca.s V_33
+ IL_027c: initobj valuetype Gen<class RefX2<int32,string>>
+ IL_0282: ldloc.s V_33
+ IL_0284: stloc.s V_33
+ IL_0286: ldloca.s V_33
+ IL_0288: ldc.i4.1
+ IL_0289: call instance void valuetype Gen<class RefX2<int32,string>>::ExceptionTest(bool)
+ IL_028e: ldloca.s V_34
+ IL_0290: initobj valuetype Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>
+ IL_0296: ldloc.s V_34
+ IL_0298: stloc.s V_34
+ IL_029a: ldloca.s V_34
+ IL_029c: ldc.i4.1
+ IL_029d: call instance void valuetype Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_02a2: ldloca.s V_35
+ IL_02a4: initobj valuetype Gen<class RefX1<class RefX1<int32>>>
+ IL_02aa: ldloc.s V_35
+ IL_02ac: stloc.s V_35
+ IL_02ae: ldloca.s V_35
+ IL_02b0: ldc.i4.1
+ IL_02b1: call instance void valuetype Gen<class RefX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_02b6: ldloca.s V_36
+ IL_02b8: initobj valuetype Gen<class RefX1<class RefX1<class RefX1<string>>>>
+ IL_02be: ldloc.s V_36
+ IL_02c0: stloc.s V_36
+ IL_02c2: ldloca.s V_36
+ IL_02c4: ldc.i4.1
+ IL_02c5: call instance void valuetype Gen<class RefX1<class RefX1<class RefX1<string>>>>::ExceptionTest(bool)
+ IL_02ca: ldloca.s V_37
+ IL_02cc: initobj valuetype Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>
+ IL_02d2: ldloc.s V_37
+ IL_02d4: stloc.s V_37
+ IL_02d6: ldloca.s V_37
+ IL_02d8: ldc.i4.1
+ IL_02d9: call instance void valuetype Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_02de: ldloca.s V_38
+ IL_02e0: initobj valuetype Gen<class RefX1<class RefX2<int32,string>>>
+ IL_02e6: ldloc.s V_38
+ IL_02e8: stloc.s V_38
+ IL_02ea: ldloca.s V_38
+ IL_02ec: ldc.i4.1
+ IL_02ed: call instance void valuetype Gen<class RefX1<class RefX2<int32,string>>>::ExceptionTest(bool)
+ IL_02f2: ldloca.s V_39
+ IL_02f4: initobj valuetype Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>
+ IL_02fa: ldloc.s V_39
+ IL_02fc: stloc.s V_39
+ IL_02fe: ldloca.s V_39
+ IL_0300: ldc.i4.1
+ IL_0301: call instance void valuetype Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_0306: ldloca.s V_40
+ IL_0308: initobj valuetype Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>
+ IL_030e: ldloc.s V_40
+ IL_0310: stloc.s V_40
+ IL_0312: ldloca.s V_40
+ IL_0314: ldc.i4.1
+ IL_0315: call instance void valuetype Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_031a: ldloca.s V_41
+ IL_031c: initobj valuetype Gen<valuetype ValX1<int32>>
+ IL_0322: ldloc.s V_41
+ IL_0324: stloc.s V_41
+ IL_0326: ldloca.s V_41
+ IL_0328: ldc.i4.1
+ IL_0329: call instance void valuetype Gen<valuetype ValX1<int32>>::ExceptionTest(bool)
+ IL_032e: ldloca.s V_42
+ IL_0330: initobj valuetype Gen<valuetype ValX1<class RefX1<int32>>>
+ IL_0336: ldloc.s V_42
+ IL_0338: stloc.s V_42
+ IL_033a: ldloca.s V_42
+ IL_033c: ldc.i4.1
+ IL_033d: call instance void valuetype Gen<valuetype ValX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_0342: ldloca.s V_43
+ IL_0344: initobj valuetype Gen<valuetype ValX2<int32,string>>
+ IL_034a: ldloc.s V_43
+ IL_034c: stloc.s V_43
+ IL_034e: ldloca.s V_43
+ IL_0350: ldc.i4.1
+ IL_0351: call instance void valuetype Gen<valuetype ValX2<int32,string>>::ExceptionTest(bool)
+ IL_0356: ldloca.s V_44
+ IL_0358: initobj valuetype Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>
+ IL_035e: ldloc.s V_44
+ IL_0360: stloc.s V_44
+ IL_0362: ldloca.s V_44
+ IL_0364: ldc.i4.1
+ IL_0365: call instance void valuetype Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_036a: ldloca.s V_45
+ IL_036c: initobj valuetype Gen<valuetype ValX1<valuetype ValX1<int32>>>
+ IL_0372: ldloc.s V_45
+ IL_0374: stloc.s V_45
+ IL_0376: ldloca.s V_45
+ IL_0378: ldc.i4.1
+ IL_0379: call instance void valuetype Gen<valuetype ValX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_037e: ldloca.s V_46
+ IL_0380: initobj valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>
+ IL_0386: ldloc.s V_46
+ IL_0388: stloc.s V_46
+ IL_038a: ldloca.s V_46
+ IL_038c: ldc.i4.1
+ IL_038d: call instance void valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::ExceptionTest(bool)
+ IL_0392: ldloca.s V_47
+ IL_0394: initobj valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>
+ IL_039a: ldloc.s V_47
+ IL_039c: stloc.s V_47
+ IL_039e: ldloca.s V_47
+ IL_03a0: ldc.i4.1
+ IL_03a1: call instance void valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_03a6: ldloca.s V_48
+ IL_03a8: initobj valuetype Gen<valuetype ValX1<valuetype ValX2<int32,string>>>
+ IL_03ae: ldloc.s V_48
+ IL_03b0: stloc.s V_48
+ IL_03b2: ldloca.s V_48
+ IL_03b4: ldc.i4.1
+ IL_03b5: call instance void valuetype Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::ExceptionTest(bool)
+ IL_03ba: ldloca.s V_49
+ IL_03bc: initobj valuetype Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>
+ IL_03c2: ldloc.s V_49
+ IL_03c4: stloc.s V_49
+ IL_03c6: ldloca.s V_49
+ IL_03c8: ldc.i4.1
+ IL_03c9: call instance void valuetype Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_03ce: ldloca.s V_50
+ IL_03d0: initobj valuetype Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>
+ IL_03d6: ldloc.s V_50
+ IL_03d8: stloc.s V_50
+ IL_03da: ldloca.s V_50
+ IL_03dc: ldc.i4.1
+ IL_03dd: call instance void valuetype Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_03e2: ldsfld bool Test::result
+ IL_03e7: brfalse.s IL_03f8
+ IL_03e9: ldstr "Test Passed"
+ IL_03ee: call void [System.Console]System.Console::WriteLine(string)
+ IL_03f3: ldc.i4.s 100
+ IL_03f5: stloc.0
+ IL_03f6: br.s IL_0406
+ IL_03f8: ldstr "Test Failed"
+ IL_03fd: call void [System.Console]System.Console::WriteLine(string)
+ IL_0402: ldc.i4.1
+ IL_0403: stloc.0
+ IL_0404: br.s IL_0406
+ IL_0406: ldloc.0
+ IL_0407: ret
+} // end of method Test::Main
+
+
+
+ .method private hidebysig specialname rtspecialname static
+ void .cctor() cil managed
+ {
+ // Code size 13 (0xd)
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 Test::counter
+ IL_0006: ldc.i4.1
+ IL_0007: stsfld bool Test::result
+ IL_000c: ret
+ } // end of method Test::.cctor
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+} // end of class Test
+
+
+// =============================================================
+
+
+//*********** DISASSEMBLY COMPLETE ***********************
+// WARNING: Created Win32 resource file try-fault03.res
diff --git a/tests/src/baseservices/exceptions/generics/try-fault-struct03.ilproj b/tests/src/baseservices/exceptions/generics/try-fault-struct03.ilproj
new file mode 100644
index 0000000000..9baca23341
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-fault-struct03.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="try-fault-struct03.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-fault01.il b/tests/src/baseservices/exceptions/generics/try-fault01.il
new file mode 100644
index 0000000000..8572fcd159
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-fault01.il
@@ -0,0 +1,540 @@
+// 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.
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 1.2.2211.0
+// Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
+
+
+
+// Metadata version: v1.1.2211
+.assembly extern legacy library mscorlib {}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+.assembly 'try-finally01'
+{
+
+ // --- The following custom attribute is added automatically, do not uncomment -------
+ // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
+ // bool) = ( 01 00 00 01 00 00 )
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'try-finally01.exe'
+// MVID: {736049C4-A4DA-41B1-895D-B9E4A517BBE4}
+.imagebase 0x00400000
+.subsystem 0x00000003
+.file alignment 512
+.corflags 0x00000001
+// Image base: 0x02DB0000
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public sequential ansi sealed beforefieldinit ValX0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX0
+
+.class public sequential ansi sealed beforefieldinit ValY0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY0
+
+.class public sequential ansi sealed beforefieldinit ValX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX1
+
+.class public sequential ansi sealed beforefieldinit ValY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY1
+
+.class public sequential ansi sealed beforefieldinit ValX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX2
+
+.class public sequential ansi sealed beforefieldinit ValY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY2
+
+.class public sequential ansi sealed beforefieldinit ValX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX3
+
+.class public sequential ansi sealed beforefieldinit ValY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY3
+
+.class public auto ansi beforefieldinit RefX0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX0::.ctor
+
+} // end of class RefX0
+
+.class public auto ansi beforefieldinit RefY0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY0::.ctor
+
+} // end of class RefY0
+
+.class public auto ansi beforefieldinit RefX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX1::.ctor
+
+} // end of class RefX1
+
+.class public auto ansi beforefieldinit RefY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY1::.ctor
+
+} // end of class RefY1
+
+.class public auto ansi beforefieldinit RefX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX2::.ctor
+
+} // end of class RefX2
+
+.class public auto ansi beforefieldinit RefY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY2::.ctor
+
+} // end of class RefY2
+
+.class public auto ansi beforefieldinit RefX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX3::.ctor
+
+} // end of class RefX3
+
+.class public auto ansi beforefieldinit RefY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY3::.ctor
+
+} // end of class RefY3
+
+.class public auto ansi beforefieldinit GenException<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Exception
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Exception::.ctor()
+ IL_0006: ret
+ } // end of method GenException::.ctor
+
+} // end of class GenException
+
+.class public auto ansi beforefieldinit Gen<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig instance void
+ InternalExceptionTest(bool throwException) cil managed
+ {
+ // Code size 53 (0x35)
+ .maxstack 2
+ .locals init (string V_0)
+ IL_0000: ldtoken class GenException<!0>
+ IL_0005: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ IL_000a: callvirt instance string [mscorlib]System.Type::ToString()
+ IL_000f: stloc.0
+ .try
+ {
+ IL_0010: ldarg.1
+ IL_0011: brfalse.s IL_0019
+
+ IL_0013: newobj instance void class GenException<!0>::.ctor()
+ IL_0018: throw
+
+ IL_0019: ldarg.1
+ IL_001a: ldc.i4.0
+ IL_001b: ceq
+ IL_001d: call void Test::Eval(bool)
+ IL_0022: leave.s IL_002b
+
+ } // end .try
+ fault
+ {
+ IL_0024: ldarg.1
+ IL_0025: call void Test::Eval(bool)
+ IL_002a: endfault
+ } // end handler
+ IL_002b: ldarg.1
+ IL_002c: ldc.i4.0
+ IL_002d: ceq
+ IL_002f: call void Test::Eval(bool)
+ IL_0034: ret
+ } // end of method Gen::InternalExceptionTest
+
+ .method public hidebysig instance void
+ ExceptionTest(bool throwException) cil managed
+ {
+ // Code size 28 (0x1c)
+ .maxstack 2
+ .try
+ {
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: call instance void class Gen<!0>::InternalExceptionTest(bool)
+ IL_0007: ldarg.1
+ IL_0008: ldc.i4.0
+ IL_0009: ceq
+ IL_000b: call void Test::Eval(bool)
+ IL_0010: leave.s IL_001b
+
+ } // end .try
+ catch [mscorlib]System.Object
+ {
+ IL_0012: pop
+ IL_0013: ldarg.1
+ IL_0014: call void Test::Eval(bool)
+ IL_0019: leave.s IL_001b
+
+ } // end handler
+ IL_001b: ret
+ } // end of method Gen::ExceptionTest
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Gen::.ctor
+
+} // end of class Gen
+
+.class public auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+{
+ .field public static int32 counter
+ .field public static bool result
+ .method public hidebysig static void Eval(bool exp) cil managed
+ {
+ // Code size 47 (0x2f)
+ .maxstack 8
+ IL_0000: ldsfld int32 Test::counter
+ IL_0005: ldc.i4.1
+ IL_0006: add
+ IL_0007: stsfld int32 Test::counter
+ IL_000c: ldarg.0
+ IL_000d: brtrue.s IL_002e
+
+ IL_000f: ldarg.0
+ IL_0010: stsfld bool Test::result
+ IL_0015: ldstr "Test Failed at location: "
+ IL_001a: ldsfld int32 Test::counter
+ IL_001f: box [mscorlib]System.Int32
+ IL_0024: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0029: call void [System.Console]System.Console::WriteLine(string)
+ IL_002e: ret
+ } // end of method Test::Eval
+
+ .method public hidebysig static int32 Main() cil managed
+ {
+ .entrypoint
+ // Code size 588 (0x24c)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: newobj instance void class Gen<int32>::.ctor()
+ IL_0005: ldc.i4.1
+ IL_0006: call instance void class Gen<int32>::ExceptionTest(bool)
+ IL_000b: newobj instance void class Gen<float64>::.ctor()
+ IL_0010: ldc.i4.1
+ IL_0011: call instance void class Gen<float64>::ExceptionTest(bool)
+ IL_0016: newobj instance void class Gen<string>::.ctor()
+ IL_001b: ldc.i4.1
+ IL_001c: call instance void class Gen<string>::ExceptionTest(bool)
+ IL_0021: newobj instance void class Gen<object>::.ctor()
+ IL_0026: ldc.i4.1
+ IL_0027: call instance void class Gen<object>::ExceptionTest(bool)
+ IL_002c: newobj instance void class Gen<valuetype [mscorlib]System.Guid>::.ctor()
+ IL_0031: ldc.i4.1
+ IL_0032: call instance void class Gen<valuetype [mscorlib]System.Guid>::ExceptionTest(bool)
+ IL_0037: newobj instance void class Gen<int32[]>::.ctor()
+ IL_003c: ldc.i4.1
+ IL_003d: call instance void class Gen<int32[]>::ExceptionTest(bool)
+ IL_0042: newobj instance void class Gen<float64[0...,0...]>::.ctor()
+ IL_0047: ldc.i4.1
+ IL_0048: call instance void class Gen<float64[0...,0...]>::ExceptionTest(bool)
+ IL_004d: newobj instance void class Gen<string[][][]>::.ctor()
+ IL_0052: ldc.i4.1
+ IL_0053: call instance void class Gen<string[][][]>::ExceptionTest(bool)
+ IL_0058: newobj instance void class Gen<object[0...,0...,0...,0...]>::.ctor()
+ IL_005d: ldc.i4.1
+ IL_005e: call instance void class Gen<object[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0063: newobj instance void class Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::.ctor()
+ IL_0068: ldc.i4.1
+ IL_0069: call instance void class Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_006e: newobj instance void class Gen<class RefX1<int32>[]>::.ctor()
+ IL_0073: ldc.i4.1
+ IL_0074: call instance void class Gen<class RefX1<int32>[]>::ExceptionTest(bool)
+ IL_0079: newobj instance void class Gen<class RefX1<float64>[0...,0...]>::.ctor()
+ IL_007e: ldc.i4.1
+ IL_007f: call instance void class Gen<class RefX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0084: newobj instance void class Gen<class RefX1<string>[][][]>::.ctor()
+ IL_0089: ldc.i4.1
+ IL_008a: call instance void class Gen<class RefX1<string>[][][]>::ExceptionTest(bool)
+ IL_008f: newobj instance void class Gen<class RefX1<object>[0...,0...,0...,0...]>::.ctor()
+ IL_0094: ldc.i4.1
+ IL_0095: call instance void class Gen<class RefX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_009a: newobj instance void class Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_009f: ldc.i4.1
+ IL_00a0: call instance void class Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00a5: newobj instance void class Gen<class RefX2<int32,int32>[]>::.ctor()
+ IL_00aa: ldc.i4.1
+ IL_00ab: call instance void class Gen<class RefX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_00b0: newobj instance void class Gen<class RefX2<float64,float64>[0...,0...]>::.ctor()
+ IL_00b5: ldc.i4.1
+ IL_00b6: call instance void class Gen<class RefX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00bb: newobj instance void class Gen<class RefX2<string,string>[][][]>::.ctor()
+ IL_00c0: ldc.i4.1
+ IL_00c1: call instance void class Gen<class RefX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_00c6: newobj instance void class Gen<class RefX2<object,object>[0...,0...,0...,0...]>::.ctor()
+ IL_00cb: ldc.i4.1
+ IL_00cc: call instance void class Gen<class RefX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_00d1: newobj instance void class Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_00d6: ldc.i4.1
+ IL_00d7: call instance void class Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00dc: newobj instance void class Gen<valuetype ValX1<int32>[]>::.ctor()
+ IL_00e1: ldc.i4.1
+ IL_00e2: call instance void class Gen<valuetype ValX1<int32>[]>::ExceptionTest(bool)
+ IL_00e7: newobj instance void class Gen<valuetype ValX1<float64>[0...,0...]>::.ctor()
+ IL_00ec: ldc.i4.1
+ IL_00ed: call instance void class Gen<valuetype ValX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00f2: newobj instance void class Gen<valuetype ValX1<string>[][][]>::.ctor()
+ IL_00f7: ldc.i4.1
+ IL_00f8: call instance void class Gen<valuetype ValX1<string>[][][]>::ExceptionTest(bool)
+ IL_00fd: newobj instance void class Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::.ctor()
+ IL_0102: ldc.i4.1
+ IL_0103: call instance void class Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0108: newobj instance void class Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_010d: ldc.i4.1
+ IL_010e: call instance void class Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_0113: newobj instance void class Gen<valuetype ValX2<int32,int32>[]>::.ctor()
+ IL_0118: ldc.i4.1
+ IL_0119: call instance void class Gen<valuetype ValX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_011e: newobj instance void class Gen<valuetype ValX2<float64,float64>[0...,0...]>::.ctor()
+ IL_0123: ldc.i4.1
+ IL_0124: call instance void class Gen<valuetype ValX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0129: newobj instance void class Gen<valuetype ValX2<string,string>[][][]>::.ctor()
+ IL_012e: ldc.i4.1
+ IL_012f: call instance void class Gen<valuetype ValX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_0134: newobj instance void class Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::.ctor()
+ IL_0139: ldc.i4.1
+ IL_013a: call instance void class Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_013f: newobj instance void class Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_0144: ldc.i4.1
+ IL_0145: call instance void class Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_014a: newobj instance void class Gen<class RefX1<int32>>::.ctor()
+ IL_014f: ldc.i4.1
+ IL_0150: call instance void class Gen<class RefX1<int32>>::ExceptionTest(bool)
+ IL_0155: newobj instance void class Gen<class RefX1<valuetype ValX1<int32>>>::.ctor()
+ IL_015a: ldc.i4.1
+ IL_015b: call instance void class Gen<class RefX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_0160: newobj instance void class Gen<class RefX2<int32,string>>::.ctor()
+ IL_0165: ldc.i4.1
+ IL_0166: call instance void class Gen<class RefX2<int32,string>>::ExceptionTest(bool)
+ IL_016b: newobj instance void class Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::.ctor()
+ IL_0170: ldc.i4.1
+ IL_0171: call instance void class Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_0176: newobj instance void class Gen<class RefX1<class RefX1<int32>>>::.ctor()
+ IL_017b: ldc.i4.1
+ IL_017c: call instance void class Gen<class RefX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_0181: newobj instance void class Gen<class RefX1<class RefX1<class RefX1<string>>>>::.ctor()
+ IL_0186: ldc.i4.1
+ IL_0187: call instance void class Gen<class RefX1<class RefX1<class RefX1<string>>>>::ExceptionTest(bool)
+ IL_018c: newobj instance void class Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::.ctor()
+ IL_0191: ldc.i4.1
+ IL_0192: call instance void class Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_0197: newobj instance void class Gen<class RefX1<class RefX2<int32,string>>>::.ctor()
+ IL_019c: ldc.i4.1
+ IL_019d: call instance void class Gen<class RefX1<class RefX2<int32,string>>>::ExceptionTest(bool)
+ IL_01a2: newobj instance void class Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::.ctor()
+ IL_01a7: ldc.i4.1
+ IL_01a8: call instance void class Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_01ad: newobj instance void class Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::.ctor()
+ IL_01b2: ldc.i4.1
+ IL_01b3: call instance void class Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_01b8: newobj instance void class Gen<valuetype ValX1<int32>>::.ctor()
+ IL_01bd: ldc.i4.1
+ IL_01be: call instance void class Gen<valuetype ValX1<int32>>::ExceptionTest(bool)
+ IL_01c3: newobj instance void class Gen<valuetype ValX1<class RefX1<int32>>>::.ctor()
+ IL_01c8: ldc.i4.1
+ IL_01c9: call instance void class Gen<valuetype ValX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_01ce: newobj instance void class Gen<valuetype ValX2<int32,string>>::.ctor()
+ IL_01d3: ldc.i4.1
+ IL_01d4: call instance void class Gen<valuetype ValX2<int32,string>>::ExceptionTest(bool)
+ IL_01d9: newobj instance void class Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::.ctor()
+ IL_01de: ldc.i4.1
+ IL_01df: call instance void class Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_01e4: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<int32>>>::.ctor()
+ IL_01e9: ldc.i4.1
+ IL_01ea: call instance void class Gen<valuetype ValX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_01ef: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::.ctor()
+ IL_01f4: ldc.i4.1
+ IL_01f5: call instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::ExceptionTest(bool)
+ IL_01fa: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::.ctor()
+ IL_01ff: ldc.i4.1
+ IL_0200: call instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_0205: newobj instance void class Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::.ctor()
+ IL_020a: ldc.i4.1
+ IL_020b: call instance void class Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::ExceptionTest(bool)
+ IL_0210: newobj instance void class Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::.ctor()
+ IL_0215: ldc.i4.1
+ IL_0216: call instance void class Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_021b: newobj instance void class Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::.ctor()
+ IL_0220: ldc.i4.1
+ IL_0221: call instance void class Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_0226: ldsfld bool Test::result
+ IL_022b: brfalse.s IL_023c
+
+ IL_022d: ldstr "Test Passed"
+ IL_0232: call void [System.Console]System.Console::WriteLine(string)
+ IL_0237: ldc.i4.s 100
+ IL_0239: stloc.0
+ IL_023a: br.s IL_024a
+
+ IL_023c: ldstr "Test Failed"
+ IL_0241: call void [System.Console]System.Console::WriteLine(string)
+ IL_0246: ldc.i4.1
+ IL_0247: stloc.0
+ IL_0248: br.s IL_024a
+
+ IL_024a: ldloc.0
+ IL_024b: ret
+ } // end of method Test::Main
+
+ .method private hidebysig specialname rtspecialname static
+ void .cctor() cil managed
+ {
+ // Code size 13 (0xd)
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 Test::counter
+ IL_0006: ldc.i4.1
+ IL_0007: stsfld bool Test::result
+ IL_000c: ret
+ } // end of method Test::.cctor
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+} // end of class Test
+
+
+// =============================================================
+
+
+//*********** DISASSEMBLY COMPLETE ***********************
+// WARNING: Created Win32 resource file try-fault01.res
diff --git a/tests/src/baseservices/exceptions/generics/try-fault01.ilproj b/tests/src/baseservices/exceptions/generics/try-fault01.ilproj
new file mode 100644
index 0000000000..cc79ed1764
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-fault01.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="try-fault01.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-fault02.il b/tests/src/baseservices/exceptions/generics/try-fault02.il
new file mode 100644
index 0000000000..96323ffb5b
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-fault02.il
@@ -0,0 +1,540 @@
+// 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.
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 1.2.2211.0
+// Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
+
+
+
+// Metadata version: v1.1.2211
+.assembly extern legacy library mscorlib {}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+.assembly 'try-finally01'
+{
+
+ // --- The following custom attribute is added automatically, do not uncomment -------
+ // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
+ // bool) = ( 01 00 00 01 00 00 )
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'try-finally01.exe'
+// MVID: {736049C4-A4DA-41B1-895D-B9E4A517BBE4}
+.imagebase 0x00400000
+.subsystem 0x00000003
+.file alignment 512
+.corflags 0x00000001
+// Image base: 0x02DB0000
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public sequential ansi sealed beforefieldinit ValX0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX0
+
+.class public sequential ansi sealed beforefieldinit ValY0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY0
+
+.class public sequential ansi sealed beforefieldinit ValX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX1
+
+.class public sequential ansi sealed beforefieldinit ValY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY1
+
+.class public sequential ansi sealed beforefieldinit ValX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX2
+
+.class public sequential ansi sealed beforefieldinit ValY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY2
+
+.class public sequential ansi sealed beforefieldinit ValX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX3
+
+.class public sequential ansi sealed beforefieldinit ValY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY3
+
+.class public auto ansi beforefieldinit RefX0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX0::.ctor
+
+} // end of class RefX0
+
+.class public auto ansi beforefieldinit RefY0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY0::.ctor
+
+} // end of class RefY0
+
+.class public auto ansi beforefieldinit RefX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX1::.ctor
+
+} // end of class RefX1
+
+.class public auto ansi beforefieldinit RefY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY1::.ctor
+
+} // end of class RefY1
+
+.class public auto ansi beforefieldinit RefX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX2::.ctor
+
+} // end of class RefX2
+
+.class public auto ansi beforefieldinit RefY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY2::.ctor
+
+} // end of class RefY2
+
+.class public auto ansi beforefieldinit RefX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX3::.ctor
+
+} // end of class RefX3
+
+.class public auto ansi beforefieldinit RefY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY3::.ctor
+
+} // end of class RefY3
+
+.class public auto ansi beforefieldinit GenException<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Exception
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Exception::.ctor()
+ IL_0006: ret
+ } // end of method GenException::.ctor
+
+} // end of class GenException
+
+.class public auto ansi beforefieldinit Gen<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig instance void
+ InternalExceptionTest(bool throwException) cil managed
+ {
+ // Code size 53 (0x35)
+ .maxstack 2
+ .locals init (string V_0)
+ IL_0000: ldtoken class GenException<!0>
+ IL_0005: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ IL_000a: callvirt instance string [mscorlib]System.Type::ToString()
+ IL_000f: stloc.0
+ .try
+ {
+ IL_0010: ldarg.1
+ IL_0011: brfalse.s IL_0019
+
+ IL_0013: newobj instance void class GenException<!0>::.ctor()
+ IL_0018: throw
+
+ IL_0019: ldarg.1
+ IL_001a: ldc.i4.0
+ IL_001b: ceq
+ IL_001d: call void Test::Eval(bool)
+ IL_0022: leave.s IL_002b
+
+ } // end .try
+ fault
+ {
+ IL_0024: ldarg.1
+ IL_0025: call void Test::Eval(bool)
+ IL_002a: endfault
+ } // end handler
+ IL_002b: ldarg.1
+ IL_002c: ldc.i4.0
+ IL_002d: ceq
+ IL_002f: call void Test::Eval(bool)
+ IL_0034: ret
+ } // end of method Gen::InternalExceptionTest
+
+ .method public hidebysig instance void
+ ExceptionTest(bool throwException) cil managed
+ {
+ // Code size 28 (0x1c)
+ .maxstack 2
+ .try
+ {
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: call instance void class Gen<!0>::InternalExceptionTest(bool)
+ IL_0007: ldarg.1
+ IL_0008: ldc.i4.0
+ IL_0009: ceq
+ IL_000b: call void Test::Eval(bool)
+ IL_0010: leave.s IL_001b
+
+ } // end .try
+ catch [mscorlib]System.Object
+ {
+ IL_0012: pop
+ IL_0013: ldarg.1
+ IL_0014: call void Test::Eval(bool)
+ IL_0019: leave.s IL_001b
+
+ } // end handler
+ IL_001b: ret
+ } // end of method Gen::ExceptionTest
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Gen::.ctor
+
+} // end of class Gen
+
+.class public auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+{
+ .field public static int32 counter
+ .field public static bool result
+ .method public hidebysig static void Eval(bool exp) cil managed
+ {
+ // Code size 47 (0x2f)
+ .maxstack 8
+ IL_0000: ldsfld int32 Test::counter
+ IL_0005: ldc.i4.1
+ IL_0006: add
+ IL_0007: stsfld int32 Test::counter
+ IL_000c: ldarg.0
+ IL_000d: brtrue.s IL_002e
+
+ IL_000f: ldarg.0
+ IL_0010: stsfld bool Test::result
+ IL_0015: ldstr "Test Failed at location: "
+ IL_001a: ldsfld int32 Test::counter
+ IL_001f: box [mscorlib]System.Int32
+ IL_0024: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0029: call void [System.Console]System.Console::WriteLine(string)
+ IL_002e: ret
+ } // end of method Test::Eval
+
+ .method public hidebysig static int32 Main() cil managed
+ {
+ .entrypoint
+ // Code size 588 (0x24c)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: newobj instance void class Gen<int32>::.ctor()
+ IL_0005: ldc.i4.1
+ IL_0006: call instance void class Gen<int32>::ExceptionTest(bool)
+ IL_000b: newobj instance void class Gen<float64>::.ctor()
+ IL_0010: ldc.i4.1
+ IL_0011: call instance void class Gen<float64>::ExceptionTest(bool)
+ IL_0016: newobj instance void class Gen<string>::.ctor()
+ IL_001b: ldc.i4.1
+ IL_001c: call instance void class Gen<string>::ExceptionTest(bool)
+ IL_0021: newobj instance void class Gen<object>::.ctor()
+ IL_0026: ldc.i4.1
+ IL_0027: call instance void class Gen<object>::ExceptionTest(bool)
+ IL_002c: newobj instance void class Gen<valuetype [mscorlib]System.Guid>::.ctor()
+ IL_0031: ldc.i4.1
+ IL_0032: call instance void class Gen<valuetype [mscorlib]System.Guid>::ExceptionTest(bool)
+ IL_0037: newobj instance void class Gen<int32[]>::.ctor()
+ IL_003c: ldc.i4.1
+ IL_003d: call instance void class Gen<int32[]>::ExceptionTest(bool)
+ IL_0042: newobj instance void class Gen<float64[0...,0...]>::.ctor()
+ IL_0047: ldc.i4.1
+ IL_0048: call instance void class Gen<float64[0...,0...]>::ExceptionTest(bool)
+ IL_004d: newobj instance void class Gen<string[][][]>::.ctor()
+ IL_0052: ldc.i4.1
+ IL_0053: call instance void class Gen<string[][][]>::ExceptionTest(bool)
+ IL_0058: newobj instance void class Gen<object[0...,0...,0...,0...]>::.ctor()
+ IL_005d: ldc.i4.1
+ IL_005e: call instance void class Gen<object[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0063: newobj instance void class Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::.ctor()
+ IL_0068: ldc.i4.1
+ IL_0069: call instance void class Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_006e: newobj instance void class Gen<class RefX1<int32>[]>::.ctor()
+ IL_0073: ldc.i4.1
+ IL_0074: call instance void class Gen<class RefX1<int32>[]>::ExceptionTest(bool)
+ IL_0079: newobj instance void class Gen<class RefX1<float64>[0...,0...]>::.ctor()
+ IL_007e: ldc.i4.1
+ IL_007f: call instance void class Gen<class RefX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0084: newobj instance void class Gen<class RefX1<string>[][][]>::.ctor()
+ IL_0089: ldc.i4.1
+ IL_008a: call instance void class Gen<class RefX1<string>[][][]>::ExceptionTest(bool)
+ IL_008f: newobj instance void class Gen<class RefX1<object>[0...,0...,0...,0...]>::.ctor()
+ IL_0094: ldc.i4.1
+ IL_0095: call instance void class Gen<class RefX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_009a: newobj instance void class Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_009f: ldc.i4.1
+ IL_00a0: call instance void class Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00a5: newobj instance void class Gen<class RefX2<int32,int32>[]>::.ctor()
+ IL_00aa: ldc.i4.1
+ IL_00ab: call instance void class Gen<class RefX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_00b0: newobj instance void class Gen<class RefX2<float64,float64>[0...,0...]>::.ctor()
+ IL_00b5: ldc.i4.1
+ IL_00b6: call instance void class Gen<class RefX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00bb: newobj instance void class Gen<class RefX2<string,string>[][][]>::.ctor()
+ IL_00c0: ldc.i4.1
+ IL_00c1: call instance void class Gen<class RefX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_00c6: newobj instance void class Gen<class RefX2<object,object>[0...,0...,0...,0...]>::.ctor()
+ IL_00cb: ldc.i4.1
+ IL_00cc: call instance void class Gen<class RefX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_00d1: newobj instance void class Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_00d6: ldc.i4.1
+ IL_00d7: call instance void class Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00dc: newobj instance void class Gen<valuetype ValX1<int32>[]>::.ctor()
+ IL_00e1: ldc.i4.1
+ IL_00e2: call instance void class Gen<valuetype ValX1<int32>[]>::ExceptionTest(bool)
+ IL_00e7: newobj instance void class Gen<valuetype ValX1<float64>[0...,0...]>::.ctor()
+ IL_00ec: ldc.i4.1
+ IL_00ed: call instance void class Gen<valuetype ValX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00f2: newobj instance void class Gen<valuetype ValX1<string>[][][]>::.ctor()
+ IL_00f7: ldc.i4.1
+ IL_00f8: call instance void class Gen<valuetype ValX1<string>[][][]>::ExceptionTest(bool)
+ IL_00fd: newobj instance void class Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::.ctor()
+ IL_0102: ldc.i4.1
+ IL_0103: call instance void class Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0108: newobj instance void class Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_010d: ldc.i4.1
+ IL_010e: call instance void class Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_0113: newobj instance void class Gen<valuetype ValX2<int32,int32>[]>::.ctor()
+ IL_0118: ldc.i4.1
+ IL_0119: call instance void class Gen<valuetype ValX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_011e: newobj instance void class Gen<valuetype ValX2<float64,float64>[0...,0...]>::.ctor()
+ IL_0123: ldc.i4.1
+ IL_0124: call instance void class Gen<valuetype ValX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0129: newobj instance void class Gen<valuetype ValX2<string,string>[][][]>::.ctor()
+ IL_012e: ldc.i4.1
+ IL_012f: call instance void class Gen<valuetype ValX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_0134: newobj instance void class Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::.ctor()
+ IL_0139: ldc.i4.1
+ IL_013a: call instance void class Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_013f: newobj instance void class Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_0144: ldc.i4.1
+ IL_0145: call instance void class Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_014a: newobj instance void class Gen<class RefX1<int32>>::.ctor()
+ IL_014f: ldc.i4.1
+ IL_0150: call instance void class Gen<class RefX1<int32>>::ExceptionTest(bool)
+ IL_0155: newobj instance void class Gen<class RefX1<valuetype ValX1<int32>>>::.ctor()
+ IL_015a: ldc.i4.1
+ IL_015b: call instance void class Gen<class RefX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_0160: newobj instance void class Gen<class RefX2<int32,string>>::.ctor()
+ IL_0165: ldc.i4.1
+ IL_0166: call instance void class Gen<class RefX2<int32,string>>::ExceptionTest(bool)
+ IL_016b: newobj instance void class Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::.ctor()
+ IL_0170: ldc.i4.1
+ IL_0171: call instance void class Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_0176: newobj instance void class Gen<class RefX1<class RefX1<int32>>>::.ctor()
+ IL_017b: ldc.i4.1
+ IL_017c: call instance void class Gen<class RefX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_0181: newobj instance void class Gen<class RefX1<class RefX1<class RefX1<string>>>>::.ctor()
+ IL_0186: ldc.i4.1
+ IL_0187: call instance void class Gen<class RefX1<class RefX1<class RefX1<string>>>>::ExceptionTest(bool)
+ IL_018c: newobj instance void class Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::.ctor()
+ IL_0191: ldc.i4.1
+ IL_0192: call instance void class Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_0197: newobj instance void class Gen<class RefX1<class RefX2<int32,string>>>::.ctor()
+ IL_019c: ldc.i4.1
+ IL_019d: call instance void class Gen<class RefX1<class RefX2<int32,string>>>::ExceptionTest(bool)
+ IL_01a2: newobj instance void class Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::.ctor()
+ IL_01a7: ldc.i4.1
+ IL_01a8: call instance void class Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_01ad: newobj instance void class Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::.ctor()
+ IL_01b2: ldc.i4.1
+ IL_01b3: call instance void class Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_01b8: newobj instance void class Gen<valuetype ValX1<int32>>::.ctor()
+ IL_01bd: ldc.i4.1
+ IL_01be: call instance void class Gen<valuetype ValX1<int32>>::ExceptionTest(bool)
+ IL_01c3: newobj instance void class Gen<valuetype ValX1<class RefX1<int32>>>::.ctor()
+ IL_01c8: ldc.i4.1
+ IL_01c9: call instance void class Gen<valuetype ValX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_01ce: newobj instance void class Gen<valuetype ValX2<int32,string>>::.ctor()
+ IL_01d3: ldc.i4.1
+ IL_01d4: call instance void class Gen<valuetype ValX2<int32,string>>::ExceptionTest(bool)
+ IL_01d9: newobj instance void class Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::.ctor()
+ IL_01de: ldc.i4.1
+ IL_01df: call instance void class Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_01e4: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<int32>>>::.ctor()
+ IL_01e9: ldc.i4.1
+ IL_01ea: call instance void class Gen<valuetype ValX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_01ef: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::.ctor()
+ IL_01f4: ldc.i4.1
+ IL_01f5: call instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::ExceptionTest(bool)
+ IL_01fa: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::.ctor()
+ IL_01ff: ldc.i4.1
+ IL_0200: call instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_0205: newobj instance void class Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::.ctor()
+ IL_020a: ldc.i4.1
+ IL_020b: call instance void class Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::ExceptionTest(bool)
+ IL_0210: newobj instance void class Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::.ctor()
+ IL_0215: ldc.i4.1
+ IL_0216: call instance void class Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_021b: newobj instance void class Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::.ctor()
+ IL_0220: ldc.i4.1
+ IL_0221: call instance void class Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_0226: ldsfld bool Test::result
+ IL_022b: brfalse.s IL_023c
+
+ IL_022d: ldstr "Test Passed"
+ IL_0232: call void [System.Console]System.Console::WriteLine(string)
+ IL_0237: ldc.i4.s 100
+ IL_0239: stloc.0
+ IL_023a: br.s IL_024a
+
+ IL_023c: ldstr "Test Failed"
+ IL_0241: call void [System.Console]System.Console::WriteLine(string)
+ IL_0246: ldc.i4.1
+ IL_0247: stloc.0
+ IL_0248: br.s IL_024a
+
+ IL_024a: ldloc.0
+ IL_024b: ret
+ } // end of method Test::Main
+
+ .method private hidebysig specialname rtspecialname static
+ void .cctor() cil managed
+ {
+ // Code size 13 (0xd)
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 Test::counter
+ IL_0006: ldc.i4.1
+ IL_0007: stsfld bool Test::result
+ IL_000c: ret
+ } // end of method Test::.cctor
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+} // end of class Test
+
+
+// =============================================================
+
+
+//*********** DISASSEMBLY COMPLETE ***********************
+// WARNING: Created Win32 resource file try-fault02.res
diff --git a/tests/src/baseservices/exceptions/generics/try-fault02.ilproj b/tests/src/baseservices/exceptions/generics/try-fault02.ilproj
new file mode 100644
index 0000000000..ad9e01d4f2
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-fault02.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="try-fault02.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-fault03.il b/tests/src/baseservices/exceptions/generics/try-fault03.il
new file mode 100644
index 0000000000..53b05dc532
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-fault03.il
@@ -0,0 +1,541 @@
+// 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.
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 1.2.2211.0
+// Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
+
+
+
+// Metadata version: v1.1.2211
+.assembly extern legacy library mscorlib {}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+.assembly 'try-finally03'
+{
+
+ // --- The following custom attribute is added automatically, do not uncomment -------
+ // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
+ // bool) = ( 01 00 00 01 00 00 )
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'try-finally03.exe'
+// MVID: {64D27B72-3BAB-4B06-AC5B-6ECC5A9F3FB9}
+.imagebase 0x00400000
+.subsystem 0x00000003
+.file alignment 512
+.corflags 0x00000001
+// Image base: 0x02DB0000
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public sequential ansi sealed beforefieldinit ValX0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX0
+
+.class public sequential ansi sealed beforefieldinit ValY0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY0
+
+.class public sequential ansi sealed beforefieldinit ValX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX1
+
+.class public sequential ansi sealed beforefieldinit ValY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY1
+
+.class public sequential ansi sealed beforefieldinit ValX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX2
+
+.class public sequential ansi sealed beforefieldinit ValY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY2
+
+.class public sequential ansi sealed beforefieldinit ValX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX3
+
+.class public sequential ansi sealed beforefieldinit ValY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY3
+
+.class public auto ansi beforefieldinit RefX0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX0::.ctor
+
+} // end of class RefX0
+
+.class public auto ansi beforefieldinit RefY0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY0::.ctor
+
+} // end of class RefY0
+
+.class public auto ansi beforefieldinit RefX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX1::.ctor
+
+} // end of class RefX1
+
+.class public auto ansi beforefieldinit RefY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY1::.ctor
+
+} // end of class RefY1
+
+.class public auto ansi beforefieldinit RefX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX2::.ctor
+
+} // end of class RefX2
+
+.class public auto ansi beforefieldinit RefY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY2::.ctor
+
+} // end of class RefY2
+
+.class public auto ansi beforefieldinit RefX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX3::.ctor
+
+} // end of class RefX3
+
+.class public auto ansi beforefieldinit RefY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY3::.ctor
+
+} // end of class RefY3
+
+.class public auto ansi beforefieldinit GenException<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Exception
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Exception::.ctor()
+ IL_0006: ret
+ } // end of method GenException::.ctor
+
+} // end of class GenException
+
+.class public auto ansi beforefieldinit Gen<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .field public bool hit
+ .method public hidebysig instance void
+ InternalExceptionTest(bool throwException) cil managed
+ {
+ // Code size 42 (0x2a)
+ .maxstack 2
+ IL_0000: ldarg.0
+ IL_0001: ldc.i4.0
+ IL_0002: stfld bool class Gen<!0>::hit
+ IL_0007: ldarg.1
+ IL_0008: brfalse.s IL_0010
+
+ IL_000a: newobj instance void class GenException<!0>::.ctor()
+ IL_000f: throw
+
+ IL_0010: ldarg.1
+ IL_0011: ldc.i4.0
+ IL_0012: ceq
+ IL_0014: call void Test::Eval(bool)
+ IL_0019: leave.s IL_0028
+
+ IL_001b: ldarg.0
+ IL_001c: ldc.i4.1
+ IL_001d: stfld bool class Gen<!0>::hit
+ IL_0022: newobj instance void class GenException<class RefX1<!0>>::.ctor()
+ IL_0027: throw
+
+ IL_0028: br.s IL_0028
+ IL_002a:
+ // Exception count 1
+ .try IL_0007 to IL_001b fault handler IL_001b to IL_0028
+ } // end of method Gen::InternalExceptionTest
+
+ .method public hidebysig instance void
+ ExceptionTest(bool throwException) cil managed
+ {
+ // Code size 53 (0x35)
+ .maxstack 2
+ .locals init (class [mscorlib]System.Exception V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: call instance void class Gen<!0>::InternalExceptionTest(bool)
+ IL_0007: ldarg.1
+ IL_0008: ldc.i4.0
+ IL_0009: ceq
+ IL_000b: call void Test::Eval(bool)
+ IL_0010: leave.s IL_0034
+
+ IL_0012: stloc.0
+ IL_0013: ldarg.0
+ IL_0014: ldfld bool class Gen<!0>::hit
+ IL_0019: call void Test::Eval(bool)
+ IL_001e: ldarg.1
+ IL_001f: call void Test::Eval(bool)
+ IL_0024: ldloc.0
+ IL_0025: isinst class GenException<class RefX1<!0>>
+ IL_002a: ldnull
+ IL_002b: cgt.un
+ IL_002d: call void Test::Eval(bool)
+ IL_0032: leave.s IL_0034
+
+ IL_0034: ret
+ IL_0035:
+ // Exception count 1
+ .try IL_0000 to IL_0012 catch [mscorlib]System.Exception handler IL_0012 to IL_0034
+ } // end of method Gen::ExceptionTest
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Gen::.ctor
+
+} // end of class Gen
+
+.class public auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+{
+ .field public static int32 counter
+ .field public static bool result
+ .method public hidebysig static void Eval(bool exp) cil managed
+ {
+ // Code size 47 (0x2f)
+ .maxstack 8
+ IL_0000: ldsfld int32 Test::counter
+ IL_0005: ldc.i4.1
+ IL_0006: add
+ IL_0007: stsfld int32 Test::counter
+ IL_000c: ldarg.0
+ IL_000d: brtrue.s IL_002e
+
+ IL_000f: ldarg.0
+ IL_0010: stsfld bool Test::result
+ IL_0015: ldstr "Test Failed at location: "
+ IL_001a: ldsfld int32 Test::counter
+ IL_001f: box [mscorlib]System.Int32
+ IL_0024: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0029: call void [System.Console]System.Console::WriteLine(string)
+ IL_002e: ret
+ } // end of method Test::Eval
+
+ .method public hidebysig static int32 Main() cil managed
+ {
+ .entrypoint
+ // Code size 588 (0x24c)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: newobj instance void class Gen<int32>::.ctor()
+ IL_0005: ldc.i4.1
+ IL_0006: call instance void class Gen<int32>::ExceptionTest(bool)
+ IL_000b: newobj instance void class Gen<float64>::.ctor()
+ IL_0010: ldc.i4.1
+ IL_0011: call instance void class Gen<float64>::ExceptionTest(bool)
+ IL_0016: newobj instance void class Gen<string>::.ctor()
+ IL_001b: ldc.i4.1
+ IL_001c: call instance void class Gen<string>::ExceptionTest(bool)
+ IL_0021: newobj instance void class Gen<object>::.ctor()
+ IL_0026: ldc.i4.1
+ IL_0027: call instance void class Gen<object>::ExceptionTest(bool)
+ IL_002c: newobj instance void class Gen<valuetype [mscorlib]System.Guid>::.ctor()
+ IL_0031: ldc.i4.1
+ IL_0032: call instance void class Gen<valuetype [mscorlib]System.Guid>::ExceptionTest(bool)
+ IL_0037: newobj instance void class Gen<int32[]>::.ctor()
+ IL_003c: ldc.i4.1
+ IL_003d: call instance void class Gen<int32[]>::ExceptionTest(bool)
+ IL_0042: newobj instance void class Gen<float64[0...,0...]>::.ctor()
+ IL_0047: ldc.i4.1
+ IL_0048: call instance void class Gen<float64[0...,0...]>::ExceptionTest(bool)
+ IL_004d: newobj instance void class Gen<string[][][]>::.ctor()
+ IL_0052: ldc.i4.1
+ IL_0053: call instance void class Gen<string[][][]>::ExceptionTest(bool)
+ IL_0058: newobj instance void class Gen<object[0...,0...,0...,0...]>::.ctor()
+ IL_005d: ldc.i4.1
+ IL_005e: call instance void class Gen<object[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0063: newobj instance void class Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::.ctor()
+ IL_0068: ldc.i4.1
+ IL_0069: call instance void class Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_006e: newobj instance void class Gen<class RefX1<int32>[]>::.ctor()
+ IL_0073: ldc.i4.1
+ IL_0074: call instance void class Gen<class RefX1<int32>[]>::ExceptionTest(bool)
+ IL_0079: newobj instance void class Gen<class RefX1<float64>[0...,0...]>::.ctor()
+ IL_007e: ldc.i4.1
+ IL_007f: call instance void class Gen<class RefX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0084: newobj instance void class Gen<class RefX1<string>[][][]>::.ctor()
+ IL_0089: ldc.i4.1
+ IL_008a: call instance void class Gen<class RefX1<string>[][][]>::ExceptionTest(bool)
+ IL_008f: newobj instance void class Gen<class RefX1<object>[0...,0...,0...,0...]>::.ctor()
+ IL_0094: ldc.i4.1
+ IL_0095: call instance void class Gen<class RefX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_009a: newobj instance void class Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_009f: ldc.i4.1
+ IL_00a0: call instance void class Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00a5: newobj instance void class Gen<class RefX2<int32,int32>[]>::.ctor()
+ IL_00aa: ldc.i4.1
+ IL_00ab: call instance void class Gen<class RefX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_00b0: newobj instance void class Gen<class RefX2<float64,float64>[0...,0...]>::.ctor()
+ IL_00b5: ldc.i4.1
+ IL_00b6: call instance void class Gen<class RefX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00bb: newobj instance void class Gen<class RefX2<string,string>[][][]>::.ctor()
+ IL_00c0: ldc.i4.1
+ IL_00c1: call instance void class Gen<class RefX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_00c6: newobj instance void class Gen<class RefX2<object,object>[0...,0...,0...,0...]>::.ctor()
+ IL_00cb: ldc.i4.1
+ IL_00cc: call instance void class Gen<class RefX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_00d1: newobj instance void class Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_00d6: ldc.i4.1
+ IL_00d7: call instance void class Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00dc: newobj instance void class Gen<valuetype ValX1<int32>[]>::.ctor()
+ IL_00e1: ldc.i4.1
+ IL_00e2: call instance void class Gen<valuetype ValX1<int32>[]>::ExceptionTest(bool)
+ IL_00e7: newobj instance void class Gen<valuetype ValX1<float64>[0...,0...]>::.ctor()
+ IL_00ec: ldc.i4.1
+ IL_00ed: call instance void class Gen<valuetype ValX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00f2: newobj instance void class Gen<valuetype ValX1<string>[][][]>::.ctor()
+ IL_00f7: ldc.i4.1
+ IL_00f8: call instance void class Gen<valuetype ValX1<string>[][][]>::ExceptionTest(bool)
+ IL_00fd: newobj instance void class Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::.ctor()
+ IL_0102: ldc.i4.1
+ IL_0103: call instance void class Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0108: newobj instance void class Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_010d: ldc.i4.1
+ IL_010e: call instance void class Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_0113: newobj instance void class Gen<valuetype ValX2<int32,int32>[]>::.ctor()
+ IL_0118: ldc.i4.1
+ IL_0119: call instance void class Gen<valuetype ValX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_011e: newobj instance void class Gen<valuetype ValX2<float64,float64>[0...,0...]>::.ctor()
+ IL_0123: ldc.i4.1
+ IL_0124: call instance void class Gen<valuetype ValX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0129: newobj instance void class Gen<valuetype ValX2<string,string>[][][]>::.ctor()
+ IL_012e: ldc.i4.1
+ IL_012f: call instance void class Gen<valuetype ValX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_0134: newobj instance void class Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::.ctor()
+ IL_0139: ldc.i4.1
+ IL_013a: call instance void class Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_013f: newobj instance void class Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_0144: ldc.i4.1
+ IL_0145: call instance void class Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_014a: newobj instance void class Gen<class RefX1<int32>>::.ctor()
+ IL_014f: ldc.i4.1
+ IL_0150: call instance void class Gen<class RefX1<int32>>::ExceptionTest(bool)
+ IL_0155: newobj instance void class Gen<class RefX1<valuetype ValX1<int32>>>::.ctor()
+ IL_015a: ldc.i4.1
+ IL_015b: call instance void class Gen<class RefX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_0160: newobj instance void class Gen<class RefX2<int32,string>>::.ctor()
+ IL_0165: ldc.i4.1
+ IL_0166: call instance void class Gen<class RefX2<int32,string>>::ExceptionTest(bool)
+ IL_016b: newobj instance void class Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::.ctor()
+ IL_0170: ldc.i4.1
+ IL_0171: call instance void class Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_0176: newobj instance void class Gen<class RefX1<class RefX1<int32>>>::.ctor()
+ IL_017b: ldc.i4.1
+ IL_017c: call instance void class Gen<class RefX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_0181: newobj instance void class Gen<class RefX1<class RefX1<class RefX1<string>>>>::.ctor()
+ IL_0186: ldc.i4.1
+ IL_0187: call instance void class Gen<class RefX1<class RefX1<class RefX1<string>>>>::ExceptionTest(bool)
+ IL_018c: newobj instance void class Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::.ctor()
+ IL_0191: ldc.i4.1
+ IL_0192: call instance void class Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_0197: newobj instance void class Gen<class RefX1<class RefX2<int32,string>>>::.ctor()
+ IL_019c: ldc.i4.1
+ IL_019d: call instance void class Gen<class RefX1<class RefX2<int32,string>>>::ExceptionTest(bool)
+ IL_01a2: newobj instance void class Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::.ctor()
+ IL_01a7: ldc.i4.1
+ IL_01a8: call instance void class Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_01ad: newobj instance void class Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::.ctor()
+ IL_01b2: ldc.i4.1
+ IL_01b3: call instance void class Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_01b8: newobj instance void class Gen<valuetype ValX1<int32>>::.ctor()
+ IL_01bd: ldc.i4.1
+ IL_01be: call instance void class Gen<valuetype ValX1<int32>>::ExceptionTest(bool)
+ IL_01c3: newobj instance void class Gen<valuetype ValX1<class RefX1<int32>>>::.ctor()
+ IL_01c8: ldc.i4.1
+ IL_01c9: call instance void class Gen<valuetype ValX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_01ce: newobj instance void class Gen<valuetype ValX2<int32,string>>::.ctor()
+ IL_01d3: ldc.i4.1
+ IL_01d4: call instance void class Gen<valuetype ValX2<int32,string>>::ExceptionTest(bool)
+ IL_01d9: newobj instance void class Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::.ctor()
+ IL_01de: ldc.i4.1
+ IL_01df: call instance void class Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_01e4: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<int32>>>::.ctor()
+ IL_01e9: ldc.i4.1
+ IL_01ea: call instance void class Gen<valuetype ValX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_01ef: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::.ctor()
+ IL_01f4: ldc.i4.1
+ IL_01f5: call instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::ExceptionTest(bool)
+ IL_01fa: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::.ctor()
+ IL_01ff: ldc.i4.1
+ IL_0200: call instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_0205: newobj instance void class Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::.ctor()
+ IL_020a: ldc.i4.1
+ IL_020b: call instance void class Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::ExceptionTest(bool)
+ IL_0210: newobj instance void class Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::.ctor()
+ IL_0215: ldc.i4.1
+ IL_0216: call instance void class Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_021b: newobj instance void class Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::.ctor()
+ IL_0220: ldc.i4.1
+ IL_0221: call instance void class Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_0226: ldsfld bool Test::result
+ IL_022b: brfalse.s IL_023c
+
+ IL_022d: ldstr "Test Passed"
+ IL_0232: call void [System.Console]System.Console::WriteLine(string)
+ IL_0237: ldc.i4.s 100
+ IL_0239: stloc.0
+ IL_023a: br.s IL_024a
+
+ IL_023c: ldstr "Test Failed"
+ IL_0241: call void [System.Console]System.Console::WriteLine(string)
+ IL_0246: ldc.i4.1
+ IL_0247: stloc.0
+ IL_0248: br.s IL_024a
+
+ IL_024a: ldloc.0
+ IL_024b: ret
+ } // end of method Test::Main
+
+ .method private hidebysig specialname rtspecialname static
+ void .cctor() cil managed
+ {
+ // Code size 13 (0xd)
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 Test::counter
+ IL_0006: ldc.i4.1
+ IL_0007: stsfld bool Test::result
+ IL_000c: ret
+ } // end of method Test::.cctor
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+} // end of class Test
+
+
+// =============================================================
+
+
+//*********** DISASSEMBLY COMPLETE ***********************
+// WARNING: Created Win32 resource file try-fault03.res
diff --git a/tests/src/baseservices/exceptions/generics/try-fault03.ilproj b/tests/src/baseservices/exceptions/generics/try-fault03.ilproj
new file mode 100644
index 0000000000..516967e7d5
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-fault03.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="try-fault03.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-filter-finally01.il b/tests/src/baseservices/exceptions/generics/try-filter-finally01.il
new file mode 100644
index 0000000000..5b45064d77
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-filter-finally01.il
@@ -0,0 +1,560 @@
+// 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.
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 1.2.2211.0
+// Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
+
+
+
+// Metadata version: v1.1.2211
+.assembly extern legacy library mscorlib {}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+.assembly 'try-catch01'
+{
+
+ // --- The following custom attribute is added automatically, do not uncomment -------
+ // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
+ // bool) = ( 01 00 00 01 00 00 )
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'try-catch01.exe'
+// MVID: {76712D77-A992-40B1-9AD0-E58BD9DA334B}
+.imagebase 0x00400000
+.subsystem 0x00000003
+.file alignment 512
+.corflags 0x00000001
+// Image base: 0x02DB0000
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public sequential ansi sealed beforefieldinit ValX0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX0
+
+.class public sequential ansi sealed beforefieldinit ValY0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY0
+
+.class public sequential ansi sealed beforefieldinit ValX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX1
+
+.class public sequential ansi sealed beforefieldinit ValY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY1
+
+.class public sequential ansi sealed beforefieldinit ValX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX2
+
+.class public sequential ansi sealed beforefieldinit ValY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY2
+
+.class public sequential ansi sealed beforefieldinit ValX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX3
+
+.class public sequential ansi sealed beforefieldinit ValY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY3
+
+.class public auto ansi beforefieldinit RefX0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX0::.ctor
+
+} // end of class RefX0
+
+.class public auto ansi beforefieldinit RefY0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY0::.ctor
+
+} // end of class RefY0
+
+.class public auto ansi beforefieldinit RefX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX1::.ctor
+
+} // end of class RefX1
+
+.class public auto ansi beforefieldinit RefY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY1::.ctor
+
+} // end of class RefY1
+
+.class public auto ansi beforefieldinit RefX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX2::.ctor
+
+} // end of class RefX2
+
+.class public auto ansi beforefieldinit RefY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY2::.ctor
+
+} // end of class RefY2
+
+.class public auto ansi beforefieldinit RefX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX3::.ctor
+
+} // end of class RefX3
+
+.class public auto ansi beforefieldinit RefY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY3::.ctor
+
+} // end of class RefY3
+
+.class public auto ansi beforefieldinit GenException<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Exception
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Exception::.ctor()
+ IL_0006: ret
+ } // end of method GenException::.ctor
+
+} // end of class GenException
+
+.class public auto ansi beforefieldinit Gen<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig instance void
+ InternalExceptionTest(bool throwException) cil managed
+ {
+ // Code size 54 (0x36)
+ .maxstack 2
+ .locals init (string V_0,
+ class [mscorlib]System.Exception V_1,
+ bool V_2,
+ bool V_3)
+ .try
+ {
+ .try
+ {
+ ldc.i4.0
+ stloc.2
+ ldc.i4.0
+ stloc.3
+ IL_0010: ldarg.1
+ IL_0011: brfalse.s IL_0019
+
+ IL_0013: newobj instance void class GenException<!0>::.ctor()
+ IL_0018: throw
+
+ IL_0019: ldarg.1
+ IL_001a: brfalse.s IL_0022
+
+ IL_001c: ldc.i4.0
+ IL_001d: call void Test::Eval(bool)
+ IL_0022: leave.s Exit
+
+ } // end .try
+ filter
+ {
+ stloc.1
+ ldloc.1
+ isinst class GenException<!0>
+ ldnull
+ cgt.un
+ call void Test::Eval(bool)
+ ldc.i4.1
+ endfilter
+ }
+ {
+ pop
+ ldc.i4.1
+ stloc.2
+ leave Exit
+ }
+ }
+ finally
+ {
+ ldloc.2
+ call void Test::Eval(bool)
+ ldc.i4.1
+ stloc.3
+ endfinally
+ } // end handler
+ Exit:
+ ldloc.3
+ call void Test::Eval(bool)
+ ret
+ } // end of method Gen::InternalExceptionTest
+
+ .method public hidebysig instance void ExceptionTest(bool throwException) cil managed
+{
+ // Code size 28 (0x1c)
+ .maxstack 2
+ .try
+ {
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: call instance void class Gen<!0>::InternalExceptionTest(bool)
+ IL_0010: leave.s IL_001b
+ } // end .try
+ catch [mscorlib]System.Object
+ {
+ IL_0012: pop
+ IL_0013: ldarg.1
+ IL_0014: call void Test::Eval(bool)
+ IL_0019: leave.s IL_001b
+ } // end handler
+ IL_001b: ret
+} // end of method Gen::ExceptionTest
+
+
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Gen::.ctor
+
+} // end of class Gen
+
+.class public auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+{
+ .field public static int32 counter
+ .field public static bool result
+ .method public hidebysig static void Eval(bool exp) cil managed
+ {
+ // Code size 47 (0x2f)
+ .maxstack 8
+ IL_0000: ldsfld int32 Test::counter
+ IL_0005: ldc.i4.1
+ IL_0006: add
+ IL_0007: stsfld int32 Test::counter
+ IL_000c: ldarg.0
+ IL_000d: brtrue.s IL_002e
+
+ IL_000f: ldarg.0
+ IL_0010: stsfld bool Test::result
+ IL_0015: ldstr "Test Failed at location: "
+ IL_001a: ldsfld int32 Test::counter
+ IL_001f: box [mscorlib]System.Int32
+ IL_0024: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0029: call void [System.Console]System.Console::WriteLine(string)
+ IL_002e: ret
+ } // end of method Test::Eval
+
+ .method public hidebysig static int32 Main() cil managed
+ {
+ .entrypoint
+ // Code size 588 (0x24c)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: newobj instance void class Gen<int32>::.ctor()
+ IL_0005: ldc.i4.1
+ IL_0006: call instance void class Gen<int32>::ExceptionTest(bool)
+ IL_000b: newobj instance void class Gen<float64>::.ctor()
+ IL_0010: ldc.i4.1
+ IL_0011: call instance void class Gen<float64>::ExceptionTest(bool)
+ IL_0016: newobj instance void class Gen<string>::.ctor()
+ IL_001b: ldc.i4.1
+ IL_001c: call instance void class Gen<string>::ExceptionTest(bool)
+ IL_0021: newobj instance void class Gen<object>::.ctor()
+ IL_0026: ldc.i4.1
+ IL_0027: call instance void class Gen<object>::ExceptionTest(bool)
+ IL_002c: newobj instance void class Gen<valuetype [mscorlib]System.Guid>::.ctor()
+ IL_0031: ldc.i4.1
+ IL_0032: call instance void class Gen<valuetype [mscorlib]System.Guid>::ExceptionTest(bool)
+ IL_0037: newobj instance void class Gen<int32[]>::.ctor()
+ IL_003c: ldc.i4.1
+ IL_003d: call instance void class Gen<int32[]>::ExceptionTest(bool)
+ IL_0042: newobj instance void class Gen<float64[0...,0...]>::.ctor()
+ IL_0047: ldc.i4.1
+ IL_0048: call instance void class Gen<float64[0...,0...]>::ExceptionTest(bool)
+ IL_004d: newobj instance void class Gen<string[][][]>::.ctor()
+ IL_0052: ldc.i4.1
+ IL_0053: call instance void class Gen<string[][][]>::ExceptionTest(bool)
+ IL_0058: newobj instance void class Gen<object[0...,0...,0...,0...]>::.ctor()
+ IL_005d: ldc.i4.1
+ IL_005e: call instance void class Gen<object[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0063: newobj instance void class Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::.ctor()
+ IL_0068: ldc.i4.1
+ IL_0069: call instance void class Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_006e: newobj instance void class Gen<class RefX1<int32>[]>::.ctor()
+ IL_0073: ldc.i4.1
+ IL_0074: call instance void class Gen<class RefX1<int32>[]>::ExceptionTest(bool)
+ IL_0079: newobj instance void class Gen<class RefX1<float64>[0...,0...]>::.ctor()
+ IL_007e: ldc.i4.1
+ IL_007f: call instance void class Gen<class RefX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0084: newobj instance void class Gen<class RefX1<string>[][][]>::.ctor()
+ IL_0089: ldc.i4.1
+ IL_008a: call instance void class Gen<class RefX1<string>[][][]>::ExceptionTest(bool)
+ IL_008f: newobj instance void class Gen<class RefX1<object>[0...,0...,0...,0...]>::.ctor()
+ IL_0094: ldc.i4.1
+ IL_0095: call instance void class Gen<class RefX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_009a: newobj instance void class Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_009f: ldc.i4.1
+ IL_00a0: call instance void class Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00a5: newobj instance void class Gen<class RefX2<int32,int32>[]>::.ctor()
+ IL_00aa: ldc.i4.1
+ IL_00ab: call instance void class Gen<class RefX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_00b0: newobj instance void class Gen<class RefX2<float64,float64>[0...,0...]>::.ctor()
+ IL_00b5: ldc.i4.1
+ IL_00b6: call instance void class Gen<class RefX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00bb: newobj instance void class Gen<class RefX2<string,string>[][][]>::.ctor()
+ IL_00c0: ldc.i4.1
+ IL_00c1: call instance void class Gen<class RefX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_00c6: newobj instance void class Gen<class RefX2<object,object>[0...,0...,0...,0...]>::.ctor()
+ IL_00cb: ldc.i4.1
+ IL_00cc: call instance void class Gen<class RefX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_00d1: newobj instance void class Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_00d6: ldc.i4.1
+ IL_00d7: call instance void class Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00dc: newobj instance void class Gen<valuetype ValX1<int32>[]>::.ctor()
+ IL_00e1: ldc.i4.1
+ IL_00e2: call instance void class Gen<valuetype ValX1<int32>[]>::ExceptionTest(bool)
+ IL_00e7: newobj instance void class Gen<valuetype ValX1<float64>[0...,0...]>::.ctor()
+ IL_00ec: ldc.i4.1
+ IL_00ed: call instance void class Gen<valuetype ValX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00f2: newobj instance void class Gen<valuetype ValX1<string>[][][]>::.ctor()
+ IL_00f7: ldc.i4.1
+ IL_00f8: call instance void class Gen<valuetype ValX1<string>[][][]>::ExceptionTest(bool)
+ IL_00fd: newobj instance void class Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::.ctor()
+ IL_0102: ldc.i4.1
+ IL_0103: call instance void class Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0108: newobj instance void class Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_010d: ldc.i4.1
+ IL_010e: call instance void class Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_0113: newobj instance void class Gen<valuetype ValX2<int32,int32>[]>::.ctor()
+ IL_0118: ldc.i4.1
+ IL_0119: call instance void class Gen<valuetype ValX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_011e: newobj instance void class Gen<valuetype ValX2<float64,float64>[0...,0...]>::.ctor()
+ IL_0123: ldc.i4.1
+ IL_0124: call instance void class Gen<valuetype ValX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0129: newobj instance void class Gen<valuetype ValX2<string,string>[][][]>::.ctor()
+ IL_012e: ldc.i4.1
+ IL_012f: call instance void class Gen<valuetype ValX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_0134: newobj instance void class Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::.ctor()
+ IL_0139: ldc.i4.1
+ IL_013a: call instance void class Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_013f: newobj instance void class Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_0144: ldc.i4.1
+ IL_0145: call instance void class Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_014a: newobj instance void class Gen<class RefX1<int32>>::.ctor()
+ IL_014f: ldc.i4.1
+ IL_0150: call instance void class Gen<class RefX1<int32>>::ExceptionTest(bool)
+ IL_0155: newobj instance void class Gen<class RefX1<valuetype ValX1<int32>>>::.ctor()
+ IL_015a: ldc.i4.1
+ IL_015b: call instance void class Gen<class RefX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_0160: newobj instance void class Gen<class RefX2<int32,string>>::.ctor()
+ IL_0165: ldc.i4.1
+ IL_0166: call instance void class Gen<class RefX2<int32,string>>::ExceptionTest(bool)
+ IL_016b: newobj instance void class Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::.ctor()
+ IL_0170: ldc.i4.1
+ IL_0171: call instance void class Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_0176: newobj instance void class Gen<class RefX1<class RefX1<int32>>>::.ctor()
+ IL_017b: ldc.i4.1
+ IL_017c: call instance void class Gen<class RefX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_0181: newobj instance void class Gen<class RefX1<class RefX1<class RefX1<string>>>>::.ctor()
+ IL_0186: ldc.i4.1
+ IL_0187: call instance void class Gen<class RefX1<class RefX1<class RefX1<string>>>>::ExceptionTest(bool)
+ IL_018c: newobj instance void class Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::.ctor()
+ IL_0191: ldc.i4.1
+ IL_0192: call instance void class Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_0197: newobj instance void class Gen<class RefX1<class RefX2<int32,string>>>::.ctor()
+ IL_019c: ldc.i4.1
+ IL_019d: call instance void class Gen<class RefX1<class RefX2<int32,string>>>::ExceptionTest(bool)
+ IL_01a2: newobj instance void class Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::.ctor()
+ IL_01a7: ldc.i4.1
+ IL_01a8: call instance void class Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_01ad: newobj instance void class Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::.ctor()
+ IL_01b2: ldc.i4.1
+ IL_01b3: call instance void class Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_01b8: newobj instance void class Gen<valuetype ValX1<int32>>::.ctor()
+ IL_01bd: ldc.i4.1
+ IL_01be: call instance void class Gen<valuetype ValX1<int32>>::ExceptionTest(bool)
+ IL_01c3: newobj instance void class Gen<valuetype ValX1<class RefX1<int32>>>::.ctor()
+ IL_01c8: ldc.i4.1
+ IL_01c9: call instance void class Gen<valuetype ValX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_01ce: newobj instance void class Gen<valuetype ValX2<int32,string>>::.ctor()
+ IL_01d3: ldc.i4.1
+ IL_01d4: call instance void class Gen<valuetype ValX2<int32,string>>::ExceptionTest(bool)
+ IL_01d9: newobj instance void class Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::.ctor()
+ IL_01de: ldc.i4.1
+ IL_01df: call instance void class Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_01e4: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<int32>>>::.ctor()
+ IL_01e9: ldc.i4.1
+ IL_01ea: call instance void class Gen<valuetype ValX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_01ef: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::.ctor()
+ IL_01f4: ldc.i4.1
+ IL_01f5: call instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::ExceptionTest(bool)
+ IL_01fa: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::.ctor()
+ IL_01ff: ldc.i4.1
+ IL_0200: call instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_0205: newobj instance void class Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::.ctor()
+ IL_020a: ldc.i4.1
+ IL_020b: call instance void class Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::ExceptionTest(bool)
+ IL_0210: newobj instance void class Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::.ctor()
+ IL_0215: ldc.i4.1
+ IL_0216: call instance void class Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_021b: newobj instance void class Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::.ctor()
+ IL_0220: ldc.i4.1
+ IL_0221: call instance void class Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_0226: ldsfld bool Test::result
+ IL_022b: brfalse.s IL_023c
+
+ IL_022d: ldstr "Test Passed"
+ IL_0232: call void [System.Console]System.Console::WriteLine(string)
+ IL_0237: ldc.i4.s 100
+ IL_0239: stloc.0
+ IL_023a: br.s IL_024a
+
+ IL_023c: ldstr "Test Failed"
+ IL_0241: call void [System.Console]System.Console::WriteLine(string)
+ IL_0246: ldc.i4.1
+ IL_0247: stloc.0
+ IL_0248: br.s IL_024a
+
+ IL_024a: ldloc.0
+ IL_024b: ret
+ } // end of method Test::Main
+
+ .method private hidebysig specialname rtspecialname static
+ void .cctor() cil managed
+ {
+ // Code size 13 (0xd)
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 Test::counter
+ IL_0006: ldc.i4.1
+ IL_0007: stsfld bool Test::result
+ IL_000c: ret
+ } // end of method Test::.cctor
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+} // end of class Test
+
+
+// =============================================================
+
+
+//*********** DISASSEMBLY COMPLETE ***********************
+// WARNING: Created Win32 resource file try-filter01.res
diff --git a/tests/src/baseservices/exceptions/generics/try-filter-finally01.ilproj b/tests/src/baseservices/exceptions/generics/try-filter-finally01.ilproj
new file mode 100644
index 0000000000..49bbad6512
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-filter-finally01.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="try-filter-finally01.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-filter-finally02.il b/tests/src/baseservices/exceptions/generics/try-filter-finally02.il
new file mode 100644
index 0000000000..3fe83f7a9d
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-filter-finally02.il
@@ -0,0 +1,570 @@
+// 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.
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 1.2.2211.0
+// Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
+
+
+
+// Metadata version: v1.1.2211
+.assembly extern legacy library mscorlib {}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+.assembly 'try-catch01'
+{
+
+ // --- The following custom attribute is added automatically, do not uncomment -------
+ // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
+ // bool) = ( 01 00 00 01 00 00 )
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'try-catch01.exe'
+// MVID: {76712D77-A992-40B1-9AD0-E58BD9DA334B}
+.imagebase 0x00400000
+.subsystem 0x00000003
+.file alignment 512
+.corflags 0x00000001
+// Image base: 0x02DB0000
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public sequential ansi sealed beforefieldinit ValX0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX0
+
+.class public sequential ansi sealed beforefieldinit ValY0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY0
+
+.class public sequential ansi sealed beforefieldinit ValX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX1
+
+.class public sequential ansi sealed beforefieldinit ValY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY1
+
+.class public sequential ansi sealed beforefieldinit ValX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX2
+
+.class public sequential ansi sealed beforefieldinit ValY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY2
+
+.class public sequential ansi sealed beforefieldinit ValX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX3
+
+.class public sequential ansi sealed beforefieldinit ValY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY3
+
+.class public auto ansi beforefieldinit RefX0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX0::.ctor
+
+} // end of class RefX0
+
+.class public auto ansi beforefieldinit RefY0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY0::.ctor
+
+} // end of class RefY0
+
+.class public auto ansi beforefieldinit RefX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX1::.ctor
+
+} // end of class RefX1
+
+.class public auto ansi beforefieldinit RefY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY1::.ctor
+
+} // end of class RefY1
+
+.class public auto ansi beforefieldinit RefX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX2::.ctor
+
+} // end of class RefX2
+
+.class public auto ansi beforefieldinit RefY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY2::.ctor
+
+} // end of class RefY2
+
+.class public auto ansi beforefieldinit RefX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX3::.ctor
+
+} // end of class RefX3
+
+.class public auto ansi beforefieldinit RefY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY3::.ctor
+
+} // end of class RefY3
+
+.class public auto ansi beforefieldinit GenException<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Exception
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Exception::.ctor()
+ IL_0006: ret
+ } // end of method GenException::.ctor
+
+} // end of class GenException
+
+.class public auto ansi beforefieldinit Gen<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig instance void
+ InternalExceptionTest(bool throwException) cil managed
+ {
+ // Code size 54 (0x36)
+ .maxstack 2
+ .locals init (string V_0,
+ class [mscorlib]System.Exception V_1,
+ bool V_2,
+ bool V_3)
+ IL_0000: ldtoken class GenException<!0>
+ IL_0005: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ IL_000a: callvirt instance string [mscorlib]System.Type::ToString()
+ IL_000f: stloc.0
+ .try
+ {
+ .try
+ {
+ ldc.i4.1
+ stloc.2
+ ldc.i4.0
+ stloc.3
+ IL_0010: ldarg.1
+ IL_0011: brfalse.s IL_0019
+
+ IL_0013: newobj instance void class GenException<!0>::.ctor()
+ IL_0018: throw
+
+ IL_0019: ldarg.1
+ IL_001a: brfalse.s IL_0022
+
+ IL_001c: ldc.i4.0
+ IL_001d: call void Test::Eval(bool)
+ IL_0022: leave.s Exit
+
+ } // end .try
+ filter
+ {
+ stloc.1
+ ldloc.1
+ isinst class GenException<!0>
+ ldnull
+ cgt.un
+ call void Test::Eval(bool)
+ ldc.i4.1
+ stloc.3
+ ldc.i4.0
+ endfilter
+ }
+ {
+ pop
+ ldc.i4.0
+ stloc.2
+ leave Exit
+ }
+ }
+ finally
+ {
+ ldloc.2
+ call void Test::Eval(bool)
+ ldloc.3
+ call void Test::Eval(bool)
+ IL_002a: endfinally
+ } // end handler
+ Exit:
+ ldc.i4.0
+ call void Test::Eval(bool)
+ ret
+ } // end of method Gen::InternalExceptionTest
+
+ .method public hidebysig instance void ExceptionTest(bool throwException) cil managed
+{
+ // Code size 28 (0x1c)
+ .maxstack 2
+ .try
+ {
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: call instance void class Gen<!0>::InternalExceptionTest(bool)
+ IL_0007: ldarg.1
+ IL_0008: ldc.i4.0
+ IL_0009: ceq
+ IL_000b: call void Test::Eval(bool)
+ IL_0010: leave.s IL_001b
+ } // end .try
+ catch [mscorlib]System.Object
+ {
+ IL_0012: pop
+ IL_0013: ldarg.1
+ IL_0014: call void Test::Eval(bool)
+ IL_0019: leave.s IL_001b
+ } // end handler
+ IL_001b: ret
+} // end of method Gen::ExceptionTest
+
+
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Gen::.ctor
+
+} // end of class Gen
+
+.class public auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+{
+ .field public static int32 counter
+ .field public static bool result
+ .method public hidebysig static void Eval(bool exp) cil managed
+ {
+ // Code size 47 (0x2f)
+ .maxstack 8
+ IL_0000: ldsfld int32 Test::counter
+ IL_0005: ldc.i4.1
+ IL_0006: add
+ IL_0007: stsfld int32 Test::counter
+ IL_000c: ldarg.0
+ IL_000d: brtrue.s IL_002e
+
+ IL_000f: ldarg.0
+ IL_0010: stsfld bool Test::result
+ IL_0015: ldstr "Test Failed at location: "
+ IL_001a: ldsfld int32 Test::counter
+ IL_001f: box [mscorlib]System.Int32
+ IL_0024: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0029: call void [System.Console]System.Console::WriteLine(string)
+ IL_002e: ret
+ } // end of method Test::Eval
+
+ .method public hidebysig static int32 Main() cil managed
+ {
+ .entrypoint
+ // Code size 588 (0x24c)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: newobj instance void class Gen<int32>::.ctor()
+ IL_0005: ldc.i4.1
+ IL_0006: call instance void class Gen<int32>::ExceptionTest(bool)
+ IL_000b: newobj instance void class Gen<float64>::.ctor()
+ IL_0010: ldc.i4.1
+ IL_0011: call instance void class Gen<float64>::ExceptionTest(bool)
+ IL_0016: newobj instance void class Gen<string>::.ctor()
+ IL_001b: ldc.i4.1
+ IL_001c: call instance void class Gen<string>::ExceptionTest(bool)
+ IL_0021: newobj instance void class Gen<object>::.ctor()
+ IL_0026: ldc.i4.1
+ IL_0027: call instance void class Gen<object>::ExceptionTest(bool)
+ IL_002c: newobj instance void class Gen<valuetype [mscorlib]System.Guid>::.ctor()
+ IL_0031: ldc.i4.1
+ IL_0032: call instance void class Gen<valuetype [mscorlib]System.Guid>::ExceptionTest(bool)
+ IL_0037: newobj instance void class Gen<int32[]>::.ctor()
+ IL_003c: ldc.i4.1
+ IL_003d: call instance void class Gen<int32[]>::ExceptionTest(bool)
+ IL_0042: newobj instance void class Gen<float64[0...,0...]>::.ctor()
+ IL_0047: ldc.i4.1
+ IL_0048: call instance void class Gen<float64[0...,0...]>::ExceptionTest(bool)
+ IL_004d: newobj instance void class Gen<string[][][]>::.ctor()
+ IL_0052: ldc.i4.1
+ IL_0053: call instance void class Gen<string[][][]>::ExceptionTest(bool)
+ IL_0058: newobj instance void class Gen<object[0...,0...,0...,0...]>::.ctor()
+ IL_005d: ldc.i4.1
+ IL_005e: call instance void class Gen<object[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0063: newobj instance void class Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::.ctor()
+ IL_0068: ldc.i4.1
+ IL_0069: call instance void class Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_006e: newobj instance void class Gen<class RefX1<int32>[]>::.ctor()
+ IL_0073: ldc.i4.1
+ IL_0074: call instance void class Gen<class RefX1<int32>[]>::ExceptionTest(bool)
+ IL_0079: newobj instance void class Gen<class RefX1<float64>[0...,0...]>::.ctor()
+ IL_007e: ldc.i4.1
+ IL_007f: call instance void class Gen<class RefX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0084: newobj instance void class Gen<class RefX1<string>[][][]>::.ctor()
+ IL_0089: ldc.i4.1
+ IL_008a: call instance void class Gen<class RefX1<string>[][][]>::ExceptionTest(bool)
+ IL_008f: newobj instance void class Gen<class RefX1<object>[0...,0...,0...,0...]>::.ctor()
+ IL_0094: ldc.i4.1
+ IL_0095: call instance void class Gen<class RefX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_009a: newobj instance void class Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_009f: ldc.i4.1
+ IL_00a0: call instance void class Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00a5: newobj instance void class Gen<class RefX2<int32,int32>[]>::.ctor()
+ IL_00aa: ldc.i4.1
+ IL_00ab: call instance void class Gen<class RefX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_00b0: newobj instance void class Gen<class RefX2<float64,float64>[0...,0...]>::.ctor()
+ IL_00b5: ldc.i4.1
+ IL_00b6: call instance void class Gen<class RefX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00bb: newobj instance void class Gen<class RefX2<string,string>[][][]>::.ctor()
+ IL_00c0: ldc.i4.1
+ IL_00c1: call instance void class Gen<class RefX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_00c6: newobj instance void class Gen<class RefX2<object,object>[0...,0...,0...,0...]>::.ctor()
+ IL_00cb: ldc.i4.1
+ IL_00cc: call instance void class Gen<class RefX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_00d1: newobj instance void class Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_00d6: ldc.i4.1
+ IL_00d7: call instance void class Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00dc: newobj instance void class Gen<valuetype ValX1<int32>[]>::.ctor()
+ IL_00e1: ldc.i4.1
+ IL_00e2: call instance void class Gen<valuetype ValX1<int32>[]>::ExceptionTest(bool)
+ IL_00e7: newobj instance void class Gen<valuetype ValX1<float64>[0...,0...]>::.ctor()
+ IL_00ec: ldc.i4.1
+ IL_00ed: call instance void class Gen<valuetype ValX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00f2: newobj instance void class Gen<valuetype ValX1<string>[][][]>::.ctor()
+ IL_00f7: ldc.i4.1
+ IL_00f8: call instance void class Gen<valuetype ValX1<string>[][][]>::ExceptionTest(bool)
+ IL_00fd: newobj instance void class Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::.ctor()
+ IL_0102: ldc.i4.1
+ IL_0103: call instance void class Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0108: newobj instance void class Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_010d: ldc.i4.1
+ IL_010e: call instance void class Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_0113: newobj instance void class Gen<valuetype ValX2<int32,int32>[]>::.ctor()
+ IL_0118: ldc.i4.1
+ IL_0119: call instance void class Gen<valuetype ValX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_011e: newobj instance void class Gen<valuetype ValX2<float64,float64>[0...,0...]>::.ctor()
+ IL_0123: ldc.i4.1
+ IL_0124: call instance void class Gen<valuetype ValX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0129: newobj instance void class Gen<valuetype ValX2<string,string>[][][]>::.ctor()
+ IL_012e: ldc.i4.1
+ IL_012f: call instance void class Gen<valuetype ValX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_0134: newobj instance void class Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::.ctor()
+ IL_0139: ldc.i4.1
+ IL_013a: call instance void class Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_013f: newobj instance void class Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_0144: ldc.i4.1
+ IL_0145: call instance void class Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_014a: newobj instance void class Gen<class RefX1<int32>>::.ctor()
+ IL_014f: ldc.i4.1
+ IL_0150: call instance void class Gen<class RefX1<int32>>::ExceptionTest(bool)
+ IL_0155: newobj instance void class Gen<class RefX1<valuetype ValX1<int32>>>::.ctor()
+ IL_015a: ldc.i4.1
+ IL_015b: call instance void class Gen<class RefX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_0160: newobj instance void class Gen<class RefX2<int32,string>>::.ctor()
+ IL_0165: ldc.i4.1
+ IL_0166: call instance void class Gen<class RefX2<int32,string>>::ExceptionTest(bool)
+ IL_016b: newobj instance void class Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::.ctor()
+ IL_0170: ldc.i4.1
+ IL_0171: call instance void class Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_0176: newobj instance void class Gen<class RefX1<class RefX1<int32>>>::.ctor()
+ IL_017b: ldc.i4.1
+ IL_017c: call instance void class Gen<class RefX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_0181: newobj instance void class Gen<class RefX1<class RefX1<class RefX1<string>>>>::.ctor()
+ IL_0186: ldc.i4.1
+ IL_0187: call instance void class Gen<class RefX1<class RefX1<class RefX1<string>>>>::ExceptionTest(bool)
+ IL_018c: newobj instance void class Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::.ctor()
+ IL_0191: ldc.i4.1
+ IL_0192: call instance void class Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_0197: newobj instance void class Gen<class RefX1<class RefX2<int32,string>>>::.ctor()
+ IL_019c: ldc.i4.1
+ IL_019d: call instance void class Gen<class RefX1<class RefX2<int32,string>>>::ExceptionTest(bool)
+ IL_01a2: newobj instance void class Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::.ctor()
+ IL_01a7: ldc.i4.1
+ IL_01a8: call instance void class Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_01ad: newobj instance void class Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::.ctor()
+ IL_01b2: ldc.i4.1
+ IL_01b3: call instance void class Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_01b8: newobj instance void class Gen<valuetype ValX1<int32>>::.ctor()
+ IL_01bd: ldc.i4.1
+ IL_01be: call instance void class Gen<valuetype ValX1<int32>>::ExceptionTest(bool)
+ IL_01c3: newobj instance void class Gen<valuetype ValX1<class RefX1<int32>>>::.ctor()
+ IL_01c8: ldc.i4.1
+ IL_01c9: call instance void class Gen<valuetype ValX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_01ce: newobj instance void class Gen<valuetype ValX2<int32,string>>::.ctor()
+ IL_01d3: ldc.i4.1
+ IL_01d4: call instance void class Gen<valuetype ValX2<int32,string>>::ExceptionTest(bool)
+ IL_01d9: newobj instance void class Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::.ctor()
+ IL_01de: ldc.i4.1
+ IL_01df: call instance void class Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_01e4: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<int32>>>::.ctor()
+ IL_01e9: ldc.i4.1
+ IL_01ea: call instance void class Gen<valuetype ValX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_01ef: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::.ctor()
+ IL_01f4: ldc.i4.1
+ IL_01f5: call instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::ExceptionTest(bool)
+ IL_01fa: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::.ctor()
+ IL_01ff: ldc.i4.1
+ IL_0200: call instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_0205: newobj instance void class Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::.ctor()
+ IL_020a: ldc.i4.1
+ IL_020b: call instance void class Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::ExceptionTest(bool)
+ IL_0210: newobj instance void class Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::.ctor()
+ IL_0215: ldc.i4.1
+ IL_0216: call instance void class Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_021b: newobj instance void class Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::.ctor()
+ IL_0220: ldc.i4.1
+ IL_0221: call instance void class Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_0226: ldsfld bool Test::result
+ IL_022b: brfalse.s IL_023c
+
+ IL_022d: ldstr "Test Passed"
+ IL_0232: call void [System.Console]System.Console::WriteLine(string)
+ IL_0237: ldc.i4.s 100
+ IL_0239: stloc.0
+ IL_023a: br.s IL_024a
+
+ IL_023c: ldstr "Test Failed"
+ IL_0241: call void [System.Console]System.Console::WriteLine(string)
+ IL_0246: ldc.i4.1
+ IL_0247: stloc.0
+ IL_0248: br.s IL_024a
+
+ IL_024a: ldloc.0
+ IL_024b: ret
+ } // end of method Test::Main
+
+ .method private hidebysig specialname rtspecialname static
+ void .cctor() cil managed
+ {
+ // Code size 13 (0xd)
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 Test::counter
+ IL_0006: ldc.i4.1
+ IL_0007: stsfld bool Test::result
+ IL_000c: ret
+ } // end of method Test::.cctor
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+} // end of class Test
+
+
+// =============================================================
+
+
+//*********** DISASSEMBLY COMPLETE ***********************
+// WARNING: Created Win32 resource file try-filter01.res
diff --git a/tests/src/baseservices/exceptions/generics/try-filter-finally02.ilproj b/tests/src/baseservices/exceptions/generics/try-filter-finally02.ilproj
new file mode 100644
index 0000000000..418e59ba7d
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-filter-finally02.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="try-filter-finally02.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-filter-struct02.il b/tests/src/baseservices/exceptions/generics/try-filter-struct02.il
new file mode 100644
index 0000000000..6398a01623
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-filter-struct02.il
@@ -0,0 +1,789 @@
+// 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.
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 1.2.2211.0
+// Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
+
+
+
+// Metadata version: v1.1.2211
+.assembly extern legacy library mscorlib {}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+.assembly 'try-catch01'
+{
+
+ // --- The following custom attribute is added automatically, do not uncomment -------
+ // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
+ // bool) = ( 01 00 00 01 00 00 )
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'try-catch01.exe'
+// MVID: {76712D77-A992-40B1-9AD0-E58BD9DA334B}
+.imagebase 0x00400000
+.subsystem 0x00000003
+.file alignment 512
+.corflags 0x00000001
+// Image base: 0x02DB0000
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public sequential ansi sealed beforefieldinit ValX0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX0
+
+.class public sequential ansi sealed beforefieldinit ValY0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY0
+
+.class public sequential ansi sealed beforefieldinit ValX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX1
+
+.class public sequential ansi sealed beforefieldinit ValY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY1
+
+.class public sequential ansi sealed beforefieldinit ValX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX2
+
+.class public sequential ansi sealed beforefieldinit ValY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY2
+
+.class public sequential ansi sealed beforefieldinit ValX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX3
+
+.class public sequential ansi sealed beforefieldinit ValY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY3
+
+.class public auto ansi beforefieldinit RefX0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX0::.ctor
+
+} // end of class RefX0
+
+.class public auto ansi beforefieldinit RefY0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY0::.ctor
+
+} // end of class RefY0
+
+.class public auto ansi beforefieldinit RefX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX1::.ctor
+
+} // end of class RefX1
+
+.class public auto ansi beforefieldinit RefY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY1::.ctor
+
+} // end of class RefY1
+
+.class public auto ansi beforefieldinit RefX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX2::.ctor
+
+} // end of class RefX2
+
+.class public auto ansi beforefieldinit RefY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY2::.ctor
+
+} // end of class RefY2
+
+.class public auto ansi beforefieldinit RefX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX3::.ctor
+
+} // end of class RefX3
+
+.class public auto ansi beforefieldinit RefY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY3::.ctor
+
+} // end of class RefY3
+
+.class public auto ansi beforefieldinit GenException<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Exception
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Exception::.ctor()
+ IL_0006: ret
+ } // end of method GenException::.ctor
+
+} // end of class GenException
+
+.class public sequential ansi sealed beforefieldinit Gen<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .method public hidebysig instance void
+ InternalExceptionTest(bool throwException) cil managed
+ {
+ // Code size 54 (0x36)
+ .maxstack 2
+ .locals init (string V_0,
+ class [mscorlib]System.Exception V_1,
+ bool V_2)
+ IL_0000: ldtoken class GenException<!0>
+ IL_0005: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ IL_000a: callvirt instance string [mscorlib]System.Type::ToString()
+ IL_000f: stloc.0
+ .try
+ {
+ ldc.i4.1
+ stloc.2
+ IL_0010: ldarg.1
+ IL_0011: brfalse.s IL_0019
+
+ IL_0013: newobj instance void class GenException<!0>::.ctor()
+ IL_0018: throw
+
+ IL_0019: ldarg.1
+ IL_001a: brfalse.s IL_0022
+
+ IL_001c: ldc.i4.0
+ IL_001d: call void Test::Eval(bool)
+ IL_0022: leave.s Exit
+
+ } // end .try
+ filter
+ {
+ stloc.1
+ ldloc.1
+ isinst class GenException<!0>
+ ldnull
+ cgt.un
+ call void Test::Eval(bool)
+ ldc.i4.0
+ endfilter
+ }
+ {
+ pop
+ ldc.i4.0
+ stloc.2
+ leave Exit
+ }
+ Exit:
+ ldloc.2
+ call void Test::Eval(bool)
+ ret
+ } // end of method Gen::InternalExceptionTest
+
+ .method public hidebysig instance void ExceptionTest(bool throwException) cil managed
+{
+ // Code size 28 (0x1c)
+ .maxstack 2
+ .try
+ {
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: call instance void valuetype Gen<!0>::InternalExceptionTest(bool)
+ IL_0007: ldarg.1
+ IL_0008: ldc.i4.0
+ IL_0009: ceq
+ IL_000b: call void Test::Eval(bool)
+ IL_0010: leave.s IL_001b
+ } // end .try
+ catch [mscorlib]System.Object
+ {
+ IL_0012: pop
+ IL_0013: ldarg.1
+ IL_0014: call void Test::Eval(bool)
+ IL_0019: leave.s IL_001b
+ } // end handler
+ IL_001b: ret
+} // end of method Gen::ExceptionTest
+
+} // end of class Gen
+
+.class public auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+{
+ .field public static int32 counter
+ .field public static bool result
+ .method public hidebysig static void Eval(bool exp) cil managed
+ {
+ // Code size 47 (0x2f)
+ .maxstack 8
+ IL_0000: ldsfld int32 Test::counter
+ IL_0005: ldc.i4.1
+ IL_0006: add
+ IL_0007: stsfld int32 Test::counter
+ IL_000c: ldarg.0
+ IL_000d: brtrue.s IL_002e
+
+ IL_000f: ldarg.0
+ IL_0010: stsfld bool Test::result
+ IL_0015: ldstr "Test Failed at location: "
+ IL_001a: ldsfld int32 Test::counter
+ IL_001f: box [mscorlib]System.Int32
+ IL_0024: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0029: call void [System.Console]System.Console::WriteLine(string)
+ IL_002e: ret
+ } // end of method Test::Eval
+
+.method public hidebysig static int32 Main() cil managed
+{
+ .entrypoint
+ // Code size 1032 (0x408)
+ .maxstack 2
+ .locals init (int32 V_0,
+ valuetype Gen<int32> V_1,
+ valuetype Gen<float64> V_2,
+ valuetype Gen<string> V_3,
+ valuetype Gen<object> V_4,
+ valuetype Gen<valuetype [mscorlib]System.Guid> V_5,
+ valuetype Gen<int32[]> V_6,
+ valuetype Gen<float64[0...,0...]> V_7,
+ valuetype Gen<string[][][]> V_8,
+ valuetype Gen<object[0...,0...,0...,0...]> V_9,
+ valuetype Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]> V_10,
+ valuetype Gen<class RefX1<int32>[]> V_11,
+ valuetype Gen<class RefX1<float64>[0...,0...]> V_12,
+ valuetype Gen<class RefX1<string>[][][]> V_13,
+ valuetype Gen<class RefX1<object>[0...,0...,0...,0...]> V_14,
+ valuetype Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_15,
+ valuetype Gen<class RefX2<int32,int32>[]> V_16,
+ valuetype Gen<class RefX2<float64,float64>[0...,0...]> V_17,
+ valuetype Gen<class RefX2<string,string>[][][]> V_18,
+ valuetype Gen<class RefX2<object,object>[0...,0...,0...,0...]> V_19,
+ valuetype Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_20,
+ valuetype Gen<valuetype ValX1<int32>[]> V_21,
+ valuetype Gen<valuetype ValX1<float64>[0...,0...]> V_22,
+ valuetype Gen<valuetype ValX1<string>[][][]> V_23,
+ valuetype Gen<valuetype ValX1<object>[0...,0...,0...,0...]> V_24,
+ valuetype Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_25,
+ valuetype Gen<valuetype ValX2<int32,int32>[]> V_26,
+ valuetype Gen<valuetype ValX2<float64,float64>[0...,0...]> V_27,
+ valuetype Gen<valuetype ValX2<string,string>[][][]> V_28,
+ valuetype Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]> V_29,
+ valuetype Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]> V_30,
+ valuetype Gen<class RefX1<int32>> V_31,
+ valuetype Gen<class RefX1<valuetype ValX1<int32>>> V_32,
+ valuetype Gen<class RefX2<int32,string>> V_33,
+ valuetype Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>> V_34,
+ valuetype Gen<class RefX1<class RefX1<int32>>> V_35,
+ valuetype Gen<class RefX1<class RefX1<class RefX1<string>>>> V_36,
+ valuetype Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>> V_37,
+ valuetype Gen<class RefX1<class RefX2<int32,string>>> V_38,
+ valuetype Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>> V_39,
+ valuetype Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>> V_40,
+ valuetype Gen<valuetype ValX1<int32>> V_41,
+ valuetype Gen<valuetype ValX1<class RefX1<int32>>> V_42,
+ valuetype Gen<valuetype ValX2<int32,string>> V_43,
+ valuetype Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>> V_44,
+ valuetype Gen<valuetype ValX1<valuetype ValX1<int32>>> V_45,
+ valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>> V_46,
+ valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>> V_47,
+ valuetype Gen<valuetype ValX1<valuetype ValX2<int32,string>>> V_48,
+ valuetype Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>> V_49,
+ valuetype Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>> V_50)
+ IL_0000: ldloca.s V_1
+ IL_0002: initobj valuetype Gen<int32>
+ IL_0008: ldloc.1
+ IL_0009: stloc.1
+ IL_000a: ldloca.s V_1
+ IL_000c: ldc.i4.1
+ IL_000d: call instance void valuetype Gen<int32>::ExceptionTest(bool)
+ IL_0012: ldloca.s V_2
+ IL_0014: initobj valuetype Gen<float64>
+ IL_001a: ldloc.2
+ IL_001b: stloc.2
+ IL_001c: ldloca.s V_2
+ IL_001e: ldc.i4.1
+ IL_001f: call instance void valuetype Gen<float64>::ExceptionTest(bool)
+ IL_0024: ldloca.s V_3
+ IL_0026: initobj valuetype Gen<string>
+ IL_002c: ldloc.3
+ IL_002d: stloc.3
+ IL_002e: ldloca.s V_3
+ IL_0030: ldc.i4.1
+ IL_0031: call instance void valuetype Gen<string>::ExceptionTest(bool)
+ IL_0036: ldloca.s V_4
+ IL_0038: initobj valuetype Gen<object>
+ IL_003e: ldloc.s V_4
+ IL_0040: stloc.s V_4
+ IL_0042: ldloca.s V_4
+ IL_0044: ldc.i4.1
+ IL_0045: call instance void valuetype Gen<object>::ExceptionTest(bool)
+ IL_004a: ldloca.s V_5
+ IL_004c: initobj valuetype Gen<valuetype [mscorlib]System.Guid>
+ IL_0052: ldloc.s V_5
+ IL_0054: stloc.s V_5
+ IL_0056: ldloca.s V_5
+ IL_0058: ldc.i4.1
+ IL_0059: call instance void valuetype Gen<valuetype [mscorlib]System.Guid>::ExceptionTest(bool)
+ IL_005e: ldloca.s V_6
+ IL_0060: initobj valuetype Gen<int32[]>
+ IL_0066: ldloc.s V_6
+ IL_0068: stloc.s V_6
+ IL_006a: ldloca.s V_6
+ IL_006c: ldc.i4.1
+ IL_006d: call instance void valuetype Gen<int32[]>::ExceptionTest(bool)
+ IL_0072: ldloca.s V_7
+ IL_0074: initobj valuetype Gen<float64[0...,0...]>
+ IL_007a: ldloc.s V_7
+ IL_007c: stloc.s V_7
+ IL_007e: ldloca.s V_7
+ IL_0080: ldc.i4.1
+ IL_0081: call instance void valuetype Gen<float64[0...,0...]>::ExceptionTest(bool)
+ IL_0086: ldloca.s V_8
+ IL_0088: initobj valuetype Gen<string[][][]>
+ IL_008e: ldloc.s V_8
+ IL_0090: stloc.s V_8
+ IL_0092: ldloca.s V_8
+ IL_0094: ldc.i4.1
+ IL_0095: call instance void valuetype Gen<string[][][]>::ExceptionTest(bool)
+ IL_009a: ldloca.s V_9
+ IL_009c: initobj valuetype Gen<object[0...,0...,0...,0...]>
+ IL_00a2: ldloc.s V_9
+ IL_00a4: stloc.s V_9
+ IL_00a6: ldloca.s V_9
+ IL_00a8: ldc.i4.1
+ IL_00a9: call instance void valuetype Gen<object[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_00ae: ldloca.s V_10
+ IL_00b0: initobj valuetype Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>
+ IL_00b6: ldloc.s V_10
+ IL_00b8: stloc.s V_10
+ IL_00ba: ldloca.s V_10
+ IL_00bc: ldc.i4.1
+ IL_00bd: call instance void valuetype Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00c2: ldloca.s V_11
+ IL_00c4: initobj valuetype Gen<class RefX1<int32>[]>
+ IL_00ca: ldloc.s V_11
+ IL_00cc: stloc.s V_11
+ IL_00ce: ldloca.s V_11
+ IL_00d0: ldc.i4.1
+ IL_00d1: call instance void valuetype Gen<class RefX1<int32>[]>::ExceptionTest(bool)
+ IL_00d6: ldloca.s V_12
+ IL_00d8: initobj valuetype Gen<class RefX1<float64>[0...,0...]>
+ IL_00de: ldloc.s V_12
+ IL_00e0: stloc.s V_12
+ IL_00e2: ldloca.s V_12
+ IL_00e4: ldc.i4.1
+ IL_00e5: call instance void valuetype Gen<class RefX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00ea: ldloca.s V_13
+ IL_00ec: initobj valuetype Gen<class RefX1<string>[][][]>
+ IL_00f2: ldloc.s V_13
+ IL_00f4: stloc.s V_13
+ IL_00f6: ldloca.s V_13
+ IL_00f8: ldc.i4.1
+ IL_00f9: call instance void valuetype Gen<class RefX1<string>[][][]>::ExceptionTest(bool)
+ IL_00fe: ldloca.s V_14
+ IL_0100: initobj valuetype Gen<class RefX1<object>[0...,0...,0...,0...]>
+ IL_0106: ldloc.s V_14
+ IL_0108: stloc.s V_14
+ IL_010a: ldloca.s V_14
+ IL_010c: ldc.i4.1
+ IL_010d: call instance void valuetype Gen<class RefX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0112: ldloca.s V_15
+ IL_0114: initobj valuetype Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_011a: ldloc.s V_15
+ IL_011c: stloc.s V_15
+ IL_011e: ldloca.s V_15
+ IL_0120: ldc.i4.1
+ IL_0121: call instance void valuetype Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_0126: ldloca.s V_16
+ IL_0128: initobj valuetype Gen<class RefX2<int32,int32>[]>
+ IL_012e: ldloc.s V_16
+ IL_0130: stloc.s V_16
+ IL_0132: ldloca.s V_16
+ IL_0134: ldc.i4.1
+ IL_0135: call instance void valuetype Gen<class RefX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_013a: ldloca.s V_17
+ IL_013c: initobj valuetype Gen<class RefX2<float64,float64>[0...,0...]>
+ IL_0142: ldloc.s V_17
+ IL_0144: stloc.s V_17
+ IL_0146: ldloca.s V_17
+ IL_0148: ldc.i4.1
+ IL_0149: call instance void valuetype Gen<class RefX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_014e: ldloca.s V_18
+ IL_0150: initobj valuetype Gen<class RefX2<string,string>[][][]>
+ IL_0156: ldloc.s V_18
+ IL_0158: stloc.s V_18
+ IL_015a: ldloca.s V_18
+ IL_015c: ldc.i4.1
+ IL_015d: call instance void valuetype Gen<class RefX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_0162: ldloca.s V_19
+ IL_0164: initobj valuetype Gen<class RefX2<object,object>[0...,0...,0...,0...]>
+ IL_016a: ldloc.s V_19
+ IL_016c: stloc.s V_19
+ IL_016e: ldloca.s V_19
+ IL_0170: ldc.i4.1
+ IL_0171: call instance void valuetype Gen<class RefX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0176: ldloca.s V_20
+ IL_0178: initobj valuetype Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_017e: ldloc.s V_20
+ IL_0180: stloc.s V_20
+ IL_0182: ldloca.s V_20
+ IL_0184: ldc.i4.1
+ IL_0185: call instance void valuetype Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_018a: ldloca.s V_21
+ IL_018c: initobj valuetype Gen<valuetype ValX1<int32>[]>
+ IL_0192: ldloc.s V_21
+ IL_0194: stloc.s V_21
+ IL_0196: ldloca.s V_21
+ IL_0198: ldc.i4.1
+ IL_0199: call instance void valuetype Gen<valuetype ValX1<int32>[]>::ExceptionTest(bool)
+ IL_019e: ldloca.s V_22
+ IL_01a0: initobj valuetype Gen<valuetype ValX1<float64>[0...,0...]>
+ IL_01a6: ldloc.s V_22
+ IL_01a8: stloc.s V_22
+ IL_01aa: ldloca.s V_22
+ IL_01ac: ldc.i4.1
+ IL_01ad: call instance void valuetype Gen<valuetype ValX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_01b2: ldloca.s V_23
+ IL_01b4: initobj valuetype Gen<valuetype ValX1<string>[][][]>
+ IL_01ba: ldloc.s V_23
+ IL_01bc: stloc.s V_23
+ IL_01be: ldloca.s V_23
+ IL_01c0: ldc.i4.1
+ IL_01c1: call instance void valuetype Gen<valuetype ValX1<string>[][][]>::ExceptionTest(bool)
+ IL_01c6: ldloca.s V_24
+ IL_01c8: initobj valuetype Gen<valuetype ValX1<object>[0...,0...,0...,0...]>
+ IL_01ce: ldloc.s V_24
+ IL_01d0: stloc.s V_24
+ IL_01d2: ldloca.s V_24
+ IL_01d4: ldc.i4.1
+ IL_01d5: call instance void valuetype Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_01da: ldloca.s V_25
+ IL_01dc: initobj valuetype Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_01e2: ldloc.s V_25
+ IL_01e4: stloc.s V_25
+ IL_01e6: ldloca.s V_25
+ IL_01e8: ldc.i4.1
+ IL_01e9: call instance void valuetype Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_01ee: ldloca.s V_26
+ IL_01f0: initobj valuetype Gen<valuetype ValX2<int32,int32>[]>
+ IL_01f6: ldloc.s V_26
+ IL_01f8: stloc.s V_26
+ IL_01fa: ldloca.s V_26
+ IL_01fc: ldc.i4.1
+ IL_01fd: call instance void valuetype Gen<valuetype ValX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_0202: ldloca.s V_27
+ IL_0204: initobj valuetype Gen<valuetype ValX2<float64,float64>[0...,0...]>
+ IL_020a: ldloc.s V_27
+ IL_020c: stloc.s V_27
+ IL_020e: ldloca.s V_27
+ IL_0210: ldc.i4.1
+ IL_0211: call instance void valuetype Gen<valuetype ValX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0216: ldloca.s V_28
+ IL_0218: initobj valuetype Gen<valuetype ValX2<string,string>[][][]>
+ IL_021e: ldloc.s V_28
+ IL_0220: stloc.s V_28
+ IL_0222: ldloca.s V_28
+ IL_0224: ldc.i4.1
+ IL_0225: call instance void valuetype Gen<valuetype ValX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_022a: ldloca.s V_29
+ IL_022c: initobj valuetype Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>
+ IL_0232: ldloc.s V_29
+ IL_0234: stloc.s V_29
+ IL_0236: ldloca.s V_29
+ IL_0238: ldc.i4.1
+ IL_0239: call instance void valuetype Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_023e: ldloca.s V_30
+ IL_0240: initobj valuetype Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>
+ IL_0246: ldloc.s V_30
+ IL_0248: stloc.s V_30
+ IL_024a: ldloca.s V_30
+ IL_024c: ldc.i4.1
+ IL_024d: call instance void valuetype Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_0252: ldloca.s V_31
+ IL_0254: initobj valuetype Gen<class RefX1<int32>>
+ IL_025a: ldloc.s V_31
+ IL_025c: stloc.s V_31
+ IL_025e: ldloca.s V_31
+ IL_0260: ldc.i4.1
+ IL_0261: call instance void valuetype Gen<class RefX1<int32>>::ExceptionTest(bool)
+ IL_0266: ldloca.s V_32
+ IL_0268: initobj valuetype Gen<class RefX1<valuetype ValX1<int32>>>
+ IL_026e: ldloc.s V_32
+ IL_0270: stloc.s V_32
+ IL_0272: ldloca.s V_32
+ IL_0274: ldc.i4.1
+ IL_0275: call instance void valuetype Gen<class RefX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_027a: ldloca.s V_33
+ IL_027c: initobj valuetype Gen<class RefX2<int32,string>>
+ IL_0282: ldloc.s V_33
+ IL_0284: stloc.s V_33
+ IL_0286: ldloca.s V_33
+ IL_0288: ldc.i4.1
+ IL_0289: call instance void valuetype Gen<class RefX2<int32,string>>::ExceptionTest(bool)
+ IL_028e: ldloca.s V_34
+ IL_0290: initobj valuetype Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>
+ IL_0296: ldloc.s V_34
+ IL_0298: stloc.s V_34
+ IL_029a: ldloca.s V_34
+ IL_029c: ldc.i4.1
+ IL_029d: call instance void valuetype Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_02a2: ldloca.s V_35
+ IL_02a4: initobj valuetype Gen<class RefX1<class RefX1<int32>>>
+ IL_02aa: ldloc.s V_35
+ IL_02ac: stloc.s V_35
+ IL_02ae: ldloca.s V_35
+ IL_02b0: ldc.i4.1
+ IL_02b1: call instance void valuetype Gen<class RefX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_02b6: ldloca.s V_36
+ IL_02b8: initobj valuetype Gen<class RefX1<class RefX1<class RefX1<string>>>>
+ IL_02be: ldloc.s V_36
+ IL_02c0: stloc.s V_36
+ IL_02c2: ldloca.s V_36
+ IL_02c4: ldc.i4.1
+ IL_02c5: call instance void valuetype Gen<class RefX1<class RefX1<class RefX1<string>>>>::ExceptionTest(bool)
+ IL_02ca: ldloca.s V_37
+ IL_02cc: initobj valuetype Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>
+ IL_02d2: ldloc.s V_37
+ IL_02d4: stloc.s V_37
+ IL_02d6: ldloca.s V_37
+ IL_02d8: ldc.i4.1
+ IL_02d9: call instance void valuetype Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_02de: ldloca.s V_38
+ IL_02e0: initobj valuetype Gen<class RefX1<class RefX2<int32,string>>>
+ IL_02e6: ldloc.s V_38
+ IL_02e8: stloc.s V_38
+ IL_02ea: ldloca.s V_38
+ IL_02ec: ldc.i4.1
+ IL_02ed: call instance void valuetype Gen<class RefX1<class RefX2<int32,string>>>::ExceptionTest(bool)
+ IL_02f2: ldloca.s V_39
+ IL_02f4: initobj valuetype Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>
+ IL_02fa: ldloc.s V_39
+ IL_02fc: stloc.s V_39
+ IL_02fe: ldloca.s V_39
+ IL_0300: ldc.i4.1
+ IL_0301: call instance void valuetype Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_0306: ldloca.s V_40
+ IL_0308: initobj valuetype Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>
+ IL_030e: ldloc.s V_40
+ IL_0310: stloc.s V_40
+ IL_0312: ldloca.s V_40
+ IL_0314: ldc.i4.1
+ IL_0315: call instance void valuetype Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_031a: ldloca.s V_41
+ IL_031c: initobj valuetype Gen<valuetype ValX1<int32>>
+ IL_0322: ldloc.s V_41
+ IL_0324: stloc.s V_41
+ IL_0326: ldloca.s V_41
+ IL_0328: ldc.i4.1
+ IL_0329: call instance void valuetype Gen<valuetype ValX1<int32>>::ExceptionTest(bool)
+ IL_032e: ldloca.s V_42
+ IL_0330: initobj valuetype Gen<valuetype ValX1<class RefX1<int32>>>
+ IL_0336: ldloc.s V_42
+ IL_0338: stloc.s V_42
+ IL_033a: ldloca.s V_42
+ IL_033c: ldc.i4.1
+ IL_033d: call instance void valuetype Gen<valuetype ValX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_0342: ldloca.s V_43
+ IL_0344: initobj valuetype Gen<valuetype ValX2<int32,string>>
+ IL_034a: ldloc.s V_43
+ IL_034c: stloc.s V_43
+ IL_034e: ldloca.s V_43
+ IL_0350: ldc.i4.1
+ IL_0351: call instance void valuetype Gen<valuetype ValX2<int32,string>>::ExceptionTest(bool)
+ IL_0356: ldloca.s V_44
+ IL_0358: initobj valuetype Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>
+ IL_035e: ldloc.s V_44
+ IL_0360: stloc.s V_44
+ IL_0362: ldloca.s V_44
+ IL_0364: ldc.i4.1
+ IL_0365: call instance void valuetype Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_036a: ldloca.s V_45
+ IL_036c: initobj valuetype Gen<valuetype ValX1<valuetype ValX1<int32>>>
+ IL_0372: ldloc.s V_45
+ IL_0374: stloc.s V_45
+ IL_0376: ldloca.s V_45
+ IL_0378: ldc.i4.1
+ IL_0379: call instance void valuetype Gen<valuetype ValX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_037e: ldloca.s V_46
+ IL_0380: initobj valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>
+ IL_0386: ldloc.s V_46
+ IL_0388: stloc.s V_46
+ IL_038a: ldloca.s V_46
+ IL_038c: ldc.i4.1
+ IL_038d: call instance void valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::ExceptionTest(bool)
+ IL_0392: ldloca.s V_47
+ IL_0394: initobj valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>
+ IL_039a: ldloc.s V_47
+ IL_039c: stloc.s V_47
+ IL_039e: ldloca.s V_47
+ IL_03a0: ldc.i4.1
+ IL_03a1: call instance void valuetype Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_03a6: ldloca.s V_48
+ IL_03a8: initobj valuetype Gen<valuetype ValX1<valuetype ValX2<int32,string>>>
+ IL_03ae: ldloc.s V_48
+ IL_03b0: stloc.s V_48
+ IL_03b2: ldloca.s V_48
+ IL_03b4: ldc.i4.1
+ IL_03b5: call instance void valuetype Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::ExceptionTest(bool)
+ IL_03ba: ldloca.s V_49
+ IL_03bc: initobj valuetype Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>
+ IL_03c2: ldloc.s V_49
+ IL_03c4: stloc.s V_49
+ IL_03c6: ldloca.s V_49
+ IL_03c8: ldc.i4.1
+ IL_03c9: call instance void valuetype Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_03ce: ldloca.s V_50
+ IL_03d0: initobj valuetype Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>
+ IL_03d6: ldloc.s V_50
+ IL_03d8: stloc.s V_50
+ IL_03da: ldloca.s V_50
+ IL_03dc: ldc.i4.1
+ IL_03dd: call instance void valuetype Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_03e2: ldsfld bool Test::result
+ IL_03e7: brfalse.s IL_03f8
+ IL_03e9: ldstr "Test Passed"
+ IL_03ee: call void [System.Console]System.Console::WriteLine(string)
+ IL_03f3: ldc.i4.s 100
+ IL_03f5: stloc.0
+ IL_03f6: br.s IL_0406
+ IL_03f8: ldstr "Test Failed"
+ IL_03fd: call void [System.Console]System.Console::WriteLine(string)
+ IL_0402: ldc.i4.1
+ IL_0403: stloc.0
+ IL_0404: br.s IL_0406
+ IL_0406: ldloc.0
+ IL_0407: ret
+} // end of method Test::Main
+
+ .method private hidebysig specialname rtspecialname static
+ void .cctor() cil managed
+ {
+ // Code size 13 (0xd)
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 Test::counter
+ IL_0006: ldc.i4.1
+ IL_0007: stsfld bool Test::result
+ IL_000c: ret
+ } // end of method Test::.cctor
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+} // end of class Test
+
+
+// =============================================================
+
+
+//*********** DISASSEMBLY COMPLETE ***********************
+// WARNING: Created Win32 resource file try-filter01.res
diff --git a/tests/src/baseservices/exceptions/generics/try-filter-struct02.ilproj b/tests/src/baseservices/exceptions/generics/try-filter-struct02.ilproj
new file mode 100644
index 0000000000..cf20a493cc
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-filter-struct02.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="try-filter-struct02.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-filter02.il b/tests/src/baseservices/exceptions/generics/try-filter02.il
new file mode 100644
index 0000000000..79ebba877d
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-filter02.il
@@ -0,0 +1,554 @@
+// 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.
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 1.2.2211.0
+// Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
+
+
+
+// Metadata version: v1.1.2211
+.assembly extern legacy library mscorlib {}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+.assembly 'try-catch01'
+{
+
+ // --- The following custom attribute is added automatically, do not uncomment -------
+ // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
+ // bool) = ( 01 00 00 01 00 00 )
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'try-catch01.exe'
+// MVID: {76712D77-A992-40B1-9AD0-E58BD9DA334B}
+.imagebase 0x00400000
+.subsystem 0x00000003
+.file alignment 512
+.corflags 0x00000001
+// Image base: 0x02DB0000
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public sequential ansi sealed beforefieldinit ValX0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX0
+
+.class public sequential ansi sealed beforefieldinit ValY0
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY0
+
+.class public sequential ansi sealed beforefieldinit ValX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX1
+
+.class public sequential ansi sealed beforefieldinit ValY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY1
+
+.class public sequential ansi sealed beforefieldinit ValX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX2
+
+.class public sequential ansi sealed beforefieldinit ValY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY2
+
+.class public sequential ansi sealed beforefieldinit ValX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValX3
+
+.class public sequential ansi sealed beforefieldinit ValY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.ValueType
+{
+ .pack 0
+ .size 1
+} // end of class ValY3
+
+.class public auto ansi beforefieldinit RefX0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX0::.ctor
+
+} // end of class RefX0
+
+.class public auto ansi beforefieldinit RefY0
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY0::.ctor
+
+} // end of class RefY0
+
+.class public auto ansi beforefieldinit RefX1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX1::.ctor
+
+} // end of class RefX1
+
+.class public auto ansi beforefieldinit RefY1<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY1::.ctor
+
+} // end of class RefY1
+
+.class public auto ansi beforefieldinit RefX2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX2::.ctor
+
+} // end of class RefX2
+
+.class public auto ansi beforefieldinit RefY2<([mscorlib]System.Object) T,([mscorlib]System.Object) U>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY2::.ctor
+
+} // end of class RefY2
+
+.class public auto ansi beforefieldinit RefX3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefX3::.ctor
+
+} // end of class RefX3
+
+.class public auto ansi beforefieldinit RefY3<([mscorlib]System.Object) T,([mscorlib]System.Object) U,([mscorlib]System.Object) V>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method RefY3::.ctor
+
+} // end of class RefY3
+
+.class public auto ansi beforefieldinit GenException<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Exception
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Exception::.ctor()
+ IL_0006: ret
+ } // end of method GenException::.ctor
+
+} // end of class GenException
+
+.class public auto ansi beforefieldinit Gen<([mscorlib]System.Object) T>
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig instance void
+ InternalExceptionTest(bool throwException) cil managed
+ {
+ // Code size 54 (0x36)
+ .maxstack 2
+ .locals init (string V_0,
+ class [mscorlib]System.Exception V_1,
+ bool V_2)
+ IL_0000: ldtoken class GenException<!0>
+ IL_0005: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ IL_000a: callvirt instance string [mscorlib]System.Type::ToString()
+ IL_000f: stloc.0
+ .try
+ {
+ ldc.i4.1
+ stloc.2
+ IL_0010: ldarg.1
+ IL_0011: brfalse.s IL_0019
+
+ IL_0013: newobj instance void class GenException<!0>::.ctor()
+ IL_0018: throw
+
+ IL_0019: ldarg.1
+ IL_001a: brfalse.s IL_0022
+
+ IL_001c: ldc.i4.0
+ IL_001d: call void Test::Eval(bool)
+ IL_0022: leave.s Exit
+
+ } // end .try
+ filter
+ {
+ stloc.1
+ ldloc.1
+ isinst class GenException<!0>
+ ldnull
+ cgt.un
+ call void Test::Eval(bool)
+ ldc.i4.0
+ endfilter
+ }
+ {
+ pop
+ ldc.i4.0
+ stloc.2
+ leave Exit
+ }
+ Exit:
+ ldloc.2
+ call void Test::Eval(bool)
+ ret
+ } // end of method Gen::InternalExceptionTest
+
+ .method public hidebysig instance void ExceptionTest(bool throwException) cil managed
+{
+ // Code size 28 (0x1c)
+ .maxstack 2
+ .try
+ {
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: call instance void class Gen<!0>::InternalExceptionTest(bool)
+ IL_0007: ldarg.1
+ IL_0008: ldc.i4.0
+ IL_0009: ceq
+ IL_000b: call void Test::Eval(bool)
+ IL_0010: leave.s IL_001b
+ } // end .try
+ catch [mscorlib]System.Object
+ {
+ IL_0012: pop
+ IL_0013: ldarg.1
+ IL_0014: call void Test::Eval(bool)
+ IL_0019: leave.s IL_001b
+ } // end handler
+ IL_001b: ret
+} // end of method Gen::ExceptionTest
+
+
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Gen::.ctor
+
+} // end of class Gen
+
+.class public auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+{
+ .field public static int32 counter
+ .field public static bool result
+ .method public hidebysig static void Eval(bool exp) cil managed
+ {
+ // Code size 47 (0x2f)
+ .maxstack 8
+ IL_0000: ldsfld int32 Test::counter
+ IL_0005: ldc.i4.1
+ IL_0006: add
+ IL_0007: stsfld int32 Test::counter
+ IL_000c: ldarg.0
+ IL_000d: brtrue.s IL_002e
+
+ IL_000f: ldarg.0
+ IL_0010: stsfld bool Test::result
+ IL_0015: ldstr "Test Failed at location: "
+ IL_001a: ldsfld int32 Test::counter
+ IL_001f: box [mscorlib]System.Int32
+ IL_0024: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0029: call void [System.Console]System.Console::WriteLine(string)
+ IL_002e: ret
+ } // end of method Test::Eval
+
+ .method public hidebysig static int32 Main() cil managed
+ {
+ .entrypoint
+ // Code size 588 (0x24c)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: newobj instance void class Gen<int32>::.ctor()
+ IL_0005: ldc.i4.1
+ IL_0006: call instance void class Gen<int32>::ExceptionTest(bool)
+ IL_000b: newobj instance void class Gen<float64>::.ctor()
+ IL_0010: ldc.i4.1
+ IL_0011: call instance void class Gen<float64>::ExceptionTest(bool)
+ IL_0016: newobj instance void class Gen<string>::.ctor()
+ IL_001b: ldc.i4.1
+ IL_001c: call instance void class Gen<string>::ExceptionTest(bool)
+ IL_0021: newobj instance void class Gen<object>::.ctor()
+ IL_0026: ldc.i4.1
+ IL_0027: call instance void class Gen<object>::ExceptionTest(bool)
+ IL_002c: newobj instance void class Gen<valuetype [mscorlib]System.Guid>::.ctor()
+ IL_0031: ldc.i4.1
+ IL_0032: call instance void class Gen<valuetype [mscorlib]System.Guid>::ExceptionTest(bool)
+ IL_0037: newobj instance void class Gen<int32[]>::.ctor()
+ IL_003c: ldc.i4.1
+ IL_003d: call instance void class Gen<int32[]>::ExceptionTest(bool)
+ IL_0042: newobj instance void class Gen<float64[0...,0...]>::.ctor()
+ IL_0047: ldc.i4.1
+ IL_0048: call instance void class Gen<float64[0...,0...]>::ExceptionTest(bool)
+ IL_004d: newobj instance void class Gen<string[][][]>::.ctor()
+ IL_0052: ldc.i4.1
+ IL_0053: call instance void class Gen<string[][][]>::ExceptionTest(bool)
+ IL_0058: newobj instance void class Gen<object[0...,0...,0...,0...]>::.ctor()
+ IL_005d: ldc.i4.1
+ IL_005e: call instance void class Gen<object[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0063: newobj instance void class Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::.ctor()
+ IL_0068: ldc.i4.1
+ IL_0069: call instance void class Gen<valuetype [mscorlib]System.Guid[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_006e: newobj instance void class Gen<class RefX1<int32>[]>::.ctor()
+ IL_0073: ldc.i4.1
+ IL_0074: call instance void class Gen<class RefX1<int32>[]>::ExceptionTest(bool)
+ IL_0079: newobj instance void class Gen<class RefX1<float64>[0...,0...]>::.ctor()
+ IL_007e: ldc.i4.1
+ IL_007f: call instance void class Gen<class RefX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0084: newobj instance void class Gen<class RefX1<string>[][][]>::.ctor()
+ IL_0089: ldc.i4.1
+ IL_008a: call instance void class Gen<class RefX1<string>[][][]>::ExceptionTest(bool)
+ IL_008f: newobj instance void class Gen<class RefX1<object>[0...,0...,0...,0...]>::.ctor()
+ IL_0094: ldc.i4.1
+ IL_0095: call instance void class Gen<class RefX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_009a: newobj instance void class Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_009f: ldc.i4.1
+ IL_00a0: call instance void class Gen<class RefX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00a5: newobj instance void class Gen<class RefX2<int32,int32>[]>::.ctor()
+ IL_00aa: ldc.i4.1
+ IL_00ab: call instance void class Gen<class RefX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_00b0: newobj instance void class Gen<class RefX2<float64,float64>[0...,0...]>::.ctor()
+ IL_00b5: ldc.i4.1
+ IL_00b6: call instance void class Gen<class RefX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00bb: newobj instance void class Gen<class RefX2<string,string>[][][]>::.ctor()
+ IL_00c0: ldc.i4.1
+ IL_00c1: call instance void class Gen<class RefX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_00c6: newobj instance void class Gen<class RefX2<object,object>[0...,0...,0...,0...]>::.ctor()
+ IL_00cb: ldc.i4.1
+ IL_00cc: call instance void class Gen<class RefX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_00d1: newobj instance void class Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_00d6: ldc.i4.1
+ IL_00d7: call instance void class Gen<class RefX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_00dc: newobj instance void class Gen<valuetype ValX1<int32>[]>::.ctor()
+ IL_00e1: ldc.i4.1
+ IL_00e2: call instance void class Gen<valuetype ValX1<int32>[]>::ExceptionTest(bool)
+ IL_00e7: newobj instance void class Gen<valuetype ValX1<float64>[0...,0...]>::.ctor()
+ IL_00ec: ldc.i4.1
+ IL_00ed: call instance void class Gen<valuetype ValX1<float64>[0...,0...]>::ExceptionTest(bool)
+ IL_00f2: newobj instance void class Gen<valuetype ValX1<string>[][][]>::.ctor()
+ IL_00f7: ldc.i4.1
+ IL_00f8: call instance void class Gen<valuetype ValX1<string>[][][]>::ExceptionTest(bool)
+ IL_00fd: newobj instance void class Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::.ctor()
+ IL_0102: ldc.i4.1
+ IL_0103: call instance void class Gen<valuetype ValX1<object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_0108: newobj instance void class Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_010d: ldc.i4.1
+ IL_010e: call instance void class Gen<valuetype ValX1<valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_0113: newobj instance void class Gen<valuetype ValX2<int32,int32>[]>::.ctor()
+ IL_0118: ldc.i4.1
+ IL_0119: call instance void class Gen<valuetype ValX2<int32,int32>[]>::ExceptionTest(bool)
+ IL_011e: newobj instance void class Gen<valuetype ValX2<float64,float64>[0...,0...]>::.ctor()
+ IL_0123: ldc.i4.1
+ IL_0124: call instance void class Gen<valuetype ValX2<float64,float64>[0...,0...]>::ExceptionTest(bool)
+ IL_0129: newobj instance void class Gen<valuetype ValX2<string,string>[][][]>::.ctor()
+ IL_012e: ldc.i4.1
+ IL_012f: call instance void class Gen<valuetype ValX2<string,string>[][][]>::ExceptionTest(bool)
+ IL_0134: newobj instance void class Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::.ctor()
+ IL_0139: ldc.i4.1
+ IL_013a: call instance void class Gen<valuetype ValX2<object,object>[0...,0...,0...,0...]>::ExceptionTest(bool)
+ IL_013f: newobj instance void class Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::.ctor()
+ IL_0144: ldc.i4.1
+ IL_0145: call instance void class Gen<valuetype ValX2<valuetype [mscorlib]System.Guid,valuetype [mscorlib]System.Guid>[][0...,0...,0...,0...][]>::ExceptionTest(bool)
+ IL_014a: newobj instance void class Gen<class RefX1<int32>>::.ctor()
+ IL_014f: ldc.i4.1
+ IL_0150: call instance void class Gen<class RefX1<int32>>::ExceptionTest(bool)
+ IL_0155: newobj instance void class Gen<class RefX1<valuetype ValX1<int32>>>::.ctor()
+ IL_015a: ldc.i4.1
+ IL_015b: call instance void class Gen<class RefX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_0160: newobj instance void class Gen<class RefX2<int32,string>>::.ctor()
+ IL_0165: ldc.i4.1
+ IL_0166: call instance void class Gen<class RefX2<int32,string>>::ExceptionTest(bool)
+ IL_016b: newobj instance void class Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::.ctor()
+ IL_0170: ldc.i4.1
+ IL_0171: call instance void class Gen<class RefX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_0176: newobj instance void class Gen<class RefX1<class RefX1<int32>>>::.ctor()
+ IL_017b: ldc.i4.1
+ IL_017c: call instance void class Gen<class RefX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_0181: newobj instance void class Gen<class RefX1<class RefX1<class RefX1<string>>>>::.ctor()
+ IL_0186: ldc.i4.1
+ IL_0187: call instance void class Gen<class RefX1<class RefX1<class RefX1<string>>>>::ExceptionTest(bool)
+ IL_018c: newobj instance void class Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::.ctor()
+ IL_0191: ldc.i4.1
+ IL_0192: call instance void class Gen<class RefX1<class RefX1<class RefX1<class RefX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_0197: newobj instance void class Gen<class RefX1<class RefX2<int32,string>>>::.ctor()
+ IL_019c: ldc.i4.1
+ IL_019d: call instance void class Gen<class RefX1<class RefX2<int32,string>>>::ExceptionTest(bool)
+ IL_01a2: newobj instance void class Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::.ctor()
+ IL_01a7: ldc.i4.1
+ IL_01a8: call instance void class Gen<class RefX2<class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>,class RefX2<class RefX1<int32>,class RefX3<int32,string,class RefX1<class RefX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_01ad: newobj instance void class Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::.ctor()
+ IL_01b2: ldc.i4.1
+ IL_01b3: call instance void class Gen<class RefX3<class RefX1<int32[0...,0...,0...,0...][]>,class RefX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,class RefX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_01b8: newobj instance void class Gen<valuetype ValX1<int32>>::.ctor()
+ IL_01bd: ldc.i4.1
+ IL_01be: call instance void class Gen<valuetype ValX1<int32>>::ExceptionTest(bool)
+ IL_01c3: newobj instance void class Gen<valuetype ValX1<class RefX1<int32>>>::.ctor()
+ IL_01c8: ldc.i4.1
+ IL_01c9: call instance void class Gen<valuetype ValX1<class RefX1<int32>>>::ExceptionTest(bool)
+ IL_01ce: newobj instance void class Gen<valuetype ValX2<int32,string>>::.ctor()
+ IL_01d3: ldc.i4.1
+ IL_01d4: call instance void class Gen<valuetype ValX2<int32,string>>::ExceptionTest(bool)
+ IL_01d9: newobj instance void class Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::.ctor()
+ IL_01de: ldc.i4.1
+ IL_01df: call instance void class Gen<valuetype ValX3<int32,string,valuetype [mscorlib]System.Guid>>::ExceptionTest(bool)
+ IL_01e4: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<int32>>>::.ctor()
+ IL_01e9: ldc.i4.1
+ IL_01ea: call instance void class Gen<valuetype ValX1<valuetype ValX1<int32>>>::ExceptionTest(bool)
+ IL_01ef: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::.ctor()
+ IL_01f4: ldc.i4.1
+ IL_01f5: call instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<string>>>>::ExceptionTest(bool)
+ IL_01fa: newobj instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::.ctor()
+ IL_01ff: ldc.i4.1
+ IL_0200: call instance void class Gen<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype ValX1<valuetype [mscorlib]System.Guid>>>>>::ExceptionTest(bool)
+ IL_0205: newobj instance void class Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::.ctor()
+ IL_020a: ldc.i4.1
+ IL_020b: call instance void class Gen<valuetype ValX1<valuetype ValX2<int32,string>>>::ExceptionTest(bool)
+ IL_0210: newobj instance void class Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::.ctor()
+ IL_0215: ldc.i4.1
+ IL_0216: call instance void class Gen<valuetype ValX2<valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>,valuetype ValX2<valuetype ValX1<int32>,valuetype ValX3<int32,string,valuetype ValX1<valuetype ValX2<int32,string>>>>>>::ExceptionTest(bool)
+ IL_021b: newobj instance void class Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::.ctor()
+ IL_0220: ldc.i4.1
+ IL_0221: call instance void class Gen<valuetype ValX3<valuetype ValX1<int32[0...,0...,0...,0...][]>,valuetype ValX2<object[][][0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][]>,valuetype ValX3<float64[0...,0...,0...,0...,0...,0...,0...,0...,0...,0...,0...],valuetype [mscorlib]System.Guid[][][][0...,0...,0...,0...,0...][0...,0...,0...,0...,0...][][][],string[][][][][][][][][][][]>>>::ExceptionTest(bool)
+ IL_0226: ldsfld bool Test::result
+ IL_022b: brfalse.s IL_023c
+
+ IL_022d: ldstr "Test Passed"
+ IL_0232: call void [System.Console]System.Console::WriteLine(string)
+ IL_0237: ldc.i4.s 100
+ IL_0239: stloc.0
+ IL_023a: br.s IL_024a
+
+ IL_023c: ldstr "Test Failed"
+ IL_0241: call void [System.Console]System.Console::WriteLine(string)
+ IL_0246: ldc.i4.1
+ IL_0247: stloc.0
+ IL_0248: br.s IL_024a
+
+ IL_024a: ldloc.0
+ IL_024b: ret
+ } // end of method Test::Main
+
+ .method private hidebysig specialname rtspecialname static
+ void .cctor() cil managed
+ {
+ // Code size 13 (0xd)
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 Test::counter
+ IL_0006: ldc.i4.1
+ IL_0007: stsfld bool Test::result
+ IL_000c: ret
+ } // end of method Test::.cctor
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+} // end of class Test
+
+
+// =============================================================
+
+
+//*********** DISASSEMBLY COMPLETE ***********************
+// WARNING: Created Win32 resource file try-filter01.res
diff --git a/tests/src/baseservices/exceptions/generics/try-filter02.ilproj b/tests/src/baseservices/exceptions/generics/try-filter02.ilproj
new file mode 100644
index 0000000000..bebcd6a537
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-filter02.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="try-filter02.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-finally-struct01.cs b/tests/src/baseservices/exceptions/generics/try-finally-struct01.cs
new file mode 100644
index 0000000000..624afd51e7
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-finally-struct01.cs
@@ -0,0 +1,153 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+public class GenException<T> : Exception {}
+public struct Gen<T>
+{
+ public bool hit;
+ public void InternalExceptionTest(bool throwException)
+ {
+ hit = false;
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ finally
+ {
+ hit = true;
+ }
+ Test.Eval(!throwException);
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ InternalExceptionTest(throwException);
+ Test.Eval(!throwException);
+ }
+ catch
+ {
+ Test.Eval(hit);
+ Test.Eval(throwException);
+ }
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-finally-struct01.csproj b/tests/src/baseservices/exceptions/generics/try-finally-struct01.csproj
new file mode 100644
index 0000000000..a7fd90f8b5
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-finally-struct01.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-finally-struct01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-finally-struct02.cs b/tests/src/baseservices/exceptions/generics/try-finally-struct02.cs
new file mode 100644
index 0000000000..6dea7cbb91
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-finally-struct02.cs
@@ -0,0 +1,152 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public struct Gen<T>
+{
+ public void InternalExceptionTest(bool throwException)
+ {
+ string ExceptionClass = typeof(GenException<T>).ToString();
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ finally
+ {
+ Test.Eval(true);
+ }
+ Test.Eval(!throwException);
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ InternalExceptionTest(throwException);
+ Test.Eval(!throwException);
+ }
+ catch
+ {
+ Test.Eval(throwException);
+ }
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(false);
+ new Gen<double>().ExceptionTest(false);
+ new Gen<string>().ExceptionTest(false);
+ new Gen<object>().ExceptionTest(false);
+ new Gen<Guid>().ExceptionTest(false);
+
+ new Gen<int[]>().ExceptionTest(false);
+ new Gen<double[,]>().ExceptionTest(false);
+ new Gen<string[][][]>().ExceptionTest(false);
+ new Gen<object[,,,]>().ExceptionTest(false);
+ new Gen<Guid[][,,,][]>().ExceptionTest(false);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(false);
+ new Gen<RefX1<double>[,]>().ExceptionTest(false);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(false);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(false);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(false);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(false);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(false);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(false);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(false);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(false);
+ new Gen<ValX1<int>[]>().ExceptionTest(false);
+ new Gen<ValX1<double>[,]>().ExceptionTest(false);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(false);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(false);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(false);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(false);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(false);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(false);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(false);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(false);
+
+ new Gen<RefX1<int>>().ExceptionTest(false);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(false);
+ new Gen<RefX2<int,string>>().ExceptionTest(false);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(false);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(false);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(false);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(false);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(false);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(false);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(false);
+
+ new Gen<ValX1<int>>().ExceptionTest(false);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(false);
+ new Gen<ValX2<int,string>>().ExceptionTest(false);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(false);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(false);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(false);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(false);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(false);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(false);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(false);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-finally-struct02.csproj b/tests/src/baseservices/exceptions/generics/try-finally-struct02.csproj
new file mode 100644
index 0000000000..873ccbe0d7
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-finally-struct02.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-finally-struct02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-finally-struct03.cs b/tests/src/baseservices/exceptions/generics/try-finally-struct03.cs
new file mode 100644
index 0000000000..4e3739a165
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-finally-struct03.cs
@@ -0,0 +1,154 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+public class GenException<T> : Exception {}
+public struct Gen<T>
+{
+ public bool hit;
+ public void InternalExceptionTest(bool throwException)
+ {
+ hit = false;
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ finally
+ {
+ hit = true;
+ throw new GenException<RefX1<T>>();
+ }
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ InternalExceptionTest(throwException);
+ Test.Eval(!throwException);
+ }
+ catch(Exception E)
+ {
+ Test.Eval(hit);
+ Test.Eval(throwException);
+ Test.Eval(E is GenException<RefX1<T>>);
+ }
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-finally-struct03.csproj b/tests/src/baseservices/exceptions/generics/try-finally-struct03.csproj
new file mode 100644
index 0000000000..91447d92fc
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-finally-struct03.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-finally-struct03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-finally01.cs b/tests/src/baseservices/exceptions/generics/try-finally01.cs
new file mode 100644
index 0000000000..25cae916c3
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-finally01.cs
@@ -0,0 +1,153 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public bool hit;
+ public void InternalExceptionTest(bool throwException)
+ {
+ hit = false;
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ finally
+ {
+ hit = true;
+ }
+ Test.Eval(!throwException);
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ InternalExceptionTest(throwException);
+ Test.Eval(!throwException);
+ }
+ catch
+ {
+ Test.Eval(hit);
+ Test.Eval(throwException);
+ }
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-finally01.csproj b/tests/src/baseservices/exceptions/generics/try-finally01.csproj
new file mode 100644
index 0000000000..c053746e21
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-finally01.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-finally01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-finally02.cs b/tests/src/baseservices/exceptions/generics/try-finally02.cs
new file mode 100644
index 0000000000..ffa55e5fb9
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-finally02.cs
@@ -0,0 +1,152 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public void InternalExceptionTest(bool throwException)
+ {
+ string ExceptionClass = typeof(GenException<T>).ToString();
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ finally
+ {
+ Test.Eval(true);
+ }
+ Test.Eval(!throwException);
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ InternalExceptionTest(throwException);
+ Test.Eval(!throwException);
+ }
+ catch
+ {
+ Test.Eval(throwException);
+ }
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(false);
+ new Gen<double>().ExceptionTest(false);
+ new Gen<string>().ExceptionTest(false);
+ new Gen<object>().ExceptionTest(false);
+ new Gen<Guid>().ExceptionTest(false);
+
+ new Gen<int[]>().ExceptionTest(false);
+ new Gen<double[,]>().ExceptionTest(false);
+ new Gen<string[][][]>().ExceptionTest(false);
+ new Gen<object[,,,]>().ExceptionTest(false);
+ new Gen<Guid[][,,,][]>().ExceptionTest(false);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(false);
+ new Gen<RefX1<double>[,]>().ExceptionTest(false);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(false);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(false);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(false);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(false);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(false);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(false);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(false);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(false);
+ new Gen<ValX1<int>[]>().ExceptionTest(false);
+ new Gen<ValX1<double>[,]>().ExceptionTest(false);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(false);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(false);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(false);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(false);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(false);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(false);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(false);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(false);
+
+ new Gen<RefX1<int>>().ExceptionTest(false);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(false);
+ new Gen<RefX2<int,string>>().ExceptionTest(false);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(false);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(false);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(false);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(false);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(false);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(false);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(false);
+
+ new Gen<ValX1<int>>().ExceptionTest(false);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(false);
+ new Gen<ValX2<int,string>>().ExceptionTest(false);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(false);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(false);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(false);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(false);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(false);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(false);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(false);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-finally02.csproj b/tests/src/baseservices/exceptions/generics/try-finally02.csproj
new file mode 100644
index 0000000000..c16cdfbbef
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-finally02.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-finally02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/try-finally03.cs b/tests/src/baseservices/exceptions/generics/try-finally03.cs
new file mode 100644
index 0000000000..8b84cc57d1
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-finally03.cs
@@ -0,0 +1,154 @@
+// 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;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+public class GenException<T> : Exception {}
+public class Gen<T>
+{
+ public bool hit;
+ public void InternalExceptionTest(bool throwException)
+ {
+ hit = false;
+ try
+ {
+ if (throwException)
+ {
+ throw new GenException<T>();
+ }
+ Test.Eval(!throwException);
+ }
+ finally
+ {
+ hit = true;
+ throw new GenException<RefX1<T>>();
+ }
+ }
+
+ public void ExceptionTest(bool throwException)
+ {
+ try
+ {
+ InternalExceptionTest(throwException);
+ Test.Eval(!throwException);
+ }
+ catch(Exception E)
+ {
+ Test.Eval(hit);
+ Test.Eval(throwException);
+ Test.Eval(E is GenException<RefX1<T>>);
+ }
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().ExceptionTest(true);
+ new Gen<double>().ExceptionTest(true);
+ new Gen<string>().ExceptionTest(true);
+ new Gen<object>().ExceptionTest(true);
+ new Gen<Guid>().ExceptionTest(true);
+
+ new Gen<int[]>().ExceptionTest(true);
+ new Gen<double[,]>().ExceptionTest(true);
+ new Gen<string[][][]>().ExceptionTest(true);
+ new Gen<object[,,,]>().ExceptionTest(true);
+ new Gen<Guid[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>[]>().ExceptionTest(true);
+ new Gen<RefX1<double>[,]>().ExceptionTest(true);
+ new Gen<RefX1<string>[][][]>().ExceptionTest(true);
+ new Gen<RefX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX1<Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<RefX2<int,int>[]>().ExceptionTest(true);
+ new Gen<RefX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<RefX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<RefX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<RefX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+ new Gen<ValX1<int>[]>().ExceptionTest(true);
+ new Gen<ValX1<double>[,]>().ExceptionTest(true);
+ new Gen<ValX1<string>[][][]>().ExceptionTest(true);
+ new Gen<ValX1<object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX1<Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<ValX2<int,int>[]>().ExceptionTest(true);
+ new Gen<ValX2<double,double>[,]>().ExceptionTest(true);
+ new Gen<ValX2<string,string>[][][]>().ExceptionTest(true);
+ new Gen<ValX2<object,object>[,,,]>().ExceptionTest(true);
+ new Gen<ValX2<Guid,Guid>[][,,,][]>().ExceptionTest(true);
+
+ new Gen<RefX1<int>>().ExceptionTest(true);
+ new Gen<RefX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<RefX2<int,string>>().ExceptionTest(true);
+ new Gen<RefX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<string>>>>().ExceptionTest(true);
+ new Gen<RefX1<RefX1<RefX1<RefX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<RefX1<RefX2<int,string>>>().ExceptionTest(true);
+ new Gen<RefX2<RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>,RefX2<RefX1<int>,RefX3<int,string, RefX1<RefX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<RefX3<RefX1<int[][,,,]>,RefX2<object[,,,][][],Guid[][][]>,RefX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+ new Gen<ValX1<int>>().ExceptionTest(true);
+ new Gen<ValX1<RefX1<int>>>().ExceptionTest(true);
+ new Gen<ValX2<int,string>>().ExceptionTest(true);
+ new Gen<ValX3<int,string,Guid>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX1<int>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<string>>>>().ExceptionTest(true);
+ new Gen<ValX1<ValX1<ValX1<ValX1<Guid>>>>>().ExceptionTest(true);
+
+ new Gen<ValX1<ValX2<int,string>>>().ExceptionTest(true);
+ new Gen<ValX2<ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>,ValX2<ValX1<int>,ValX3<int,string, ValX1<ValX2<int,string>>>>>>().ExceptionTest(true);
+ new Gen<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>().ExceptionTest(true);
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/generics/try-finally03.csproj b/tests/src/baseservices/exceptions/generics/try-finally03.csproj
new file mode 100644
index 0000000000..2d04532eec
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/try-finally03.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="try-finally03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter001.cs b/tests/src/baseservices/exceptions/generics/typeparameter001.cs
new file mode 100644
index 0000000000..4ab707b26c
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter001.cs
@@ -0,0 +1,101 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+public class GenException<T> : Exception {}
+
+public class Gen<Ex> where Ex : Exception
+{
+ public static void ExceptionTest(Ex e)
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<Exception>.ExceptionTest(new Exception());
+ Gen<Exception>.ExceptionTest(new InvalidOperationException());
+ Gen<Exception>.ExceptionTest(new GenException<int>());
+ Gen<Exception>.ExceptionTest(new GenException<string>());
+ Gen<Exception>.ExceptionTest(new GenException<Guid>());
+ Gen<Exception>.ExceptionTest(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ Gen<InvalidOperationException>.ExceptionTest(new InvalidOperationException());
+
+ Gen<GenException<int>>.ExceptionTest(new GenException<int>());
+ Gen<GenException<string>>.ExceptionTest(new GenException<string>());
+ Gen<GenException<Guid>>.ExceptionTest(new GenException<Guid>());
+ Gen<GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>>.ExceptionTest(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter002.cs b/tests/src/baseservices/exceptions/generics/typeparameter002.cs
new file mode 100644
index 0000000000..4ab707b26c
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter002.cs
@@ -0,0 +1,101 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+public class GenException<T> : Exception {}
+
+public class Gen<Ex> where Ex : Exception
+{
+ public static void ExceptionTest(Ex e)
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<Exception>.ExceptionTest(new Exception());
+ Gen<Exception>.ExceptionTest(new InvalidOperationException());
+ Gen<Exception>.ExceptionTest(new GenException<int>());
+ Gen<Exception>.ExceptionTest(new GenException<string>());
+ Gen<Exception>.ExceptionTest(new GenException<Guid>());
+ Gen<Exception>.ExceptionTest(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ Gen<InvalidOperationException>.ExceptionTest(new InvalidOperationException());
+
+ Gen<GenException<int>>.ExceptionTest(new GenException<int>());
+ Gen<GenException<string>>.ExceptionTest(new GenException<string>());
+ Gen<GenException<Guid>>.ExceptionTest(new GenException<Guid>());
+ Gen<GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>>.ExceptionTest(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter003.cs b/tests/src/baseservices/exceptions/generics/typeparameter003.cs
new file mode 100644
index 0000000000..162931f71b
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter003.cs
@@ -0,0 +1,102 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> VSW 48915 </RelatedBugs>
+
+//<Expects Status=skip></Expects>
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+public class GenException<T> : Exception {}
+
+public class Gen<Ex> where Ex : Exception
+{
+ public void ExceptionTest(Ex e)
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<Exception>().ExceptionTest(new Exception());
+ new Gen<Exception>().ExceptionTest(new InvalidOperationException());
+ new Gen<Exception>().ExceptionTest(new GenException<int>());
+ new Gen<Exception>().ExceptionTest(new GenException<string>());
+ new Gen<Exception>().ExceptionTest(new GenException<Guid>());
+ new Gen<Exception>().ExceptionTest(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ new Gen<InvalidOperationException>().ExceptionTest(new InvalidOperationException());
+
+ new Gen<GenException<int>>().ExceptionTest(new GenException<int>());
+ new Gen<GenException<string>>().ExceptionTest(new GenException<string>());
+ new Gen<GenException<Guid>>().ExceptionTest(new GenException<Guid>());
+ new Gen<GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>>().ExceptionTest(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter004.cs b/tests/src/baseservices/exceptions/generics/typeparameter004.cs
new file mode 100644
index 0000000000..6e214b1c4a
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter004.cs
@@ -0,0 +1,101 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+public class GenException<T> : Exception {}
+
+public struct Gen<Ex> where Ex : Exception
+{
+ public void ExceptionTest(Ex e)
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<Exception>().ExceptionTest(new Exception());
+ new Gen<Exception>().ExceptionTest(new InvalidOperationException());
+ new Gen<Exception>().ExceptionTest(new GenException<int>());
+ new Gen<Exception>().ExceptionTest(new GenException<string>());
+ new Gen<Exception>().ExceptionTest(new GenException<Guid>());
+ new Gen<Exception>().ExceptionTest(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ new Gen<InvalidOperationException>().ExceptionTest(new InvalidOperationException());
+
+ new Gen<GenException<int>>().ExceptionTest(new GenException<int>());
+ new Gen<GenException<string>>().ExceptionTest(new GenException<string>());
+ new Gen<GenException<Guid>>().ExceptionTest(new GenException<Guid>());
+ new Gen<GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>>().ExceptionTest(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter005.cs b/tests/src/baseservices/exceptions/generics/typeparameter005.cs
new file mode 100644
index 0000000000..2638b1e5e5
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter005.cs
@@ -0,0 +1,101 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+public class GenException<T> : Exception {}
+
+public class Gen
+{
+ public static void ExceptionTest<Ex>(Ex e) where Ex : Exception
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ExceptionTest<Exception>(new Exception());
+ Gen.ExceptionTest<Exception>(new InvalidOperationException());
+ Gen.ExceptionTest<Exception>(new GenException<int>());
+ Gen.ExceptionTest<Exception>(new GenException<string>());
+ Gen.ExceptionTest<Exception>(new GenException<Guid>());
+ Gen.ExceptionTest<Exception>(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ Gen.ExceptionTest<InvalidOperationException>(new InvalidOperationException());
+
+ Gen.ExceptionTest<GenException<int>>(new GenException<int>());
+ Gen.ExceptionTest<GenException<string>>(new GenException<string>());
+ Gen.ExceptionTest<GenException<Guid>>(new GenException<Guid>());
+ Gen.ExceptionTest<GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>>(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter006.cs b/tests/src/baseservices/exceptions/generics/typeparameter006.cs
new file mode 100644
index 0000000000..947dbde8f0
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter006.cs
@@ -0,0 +1,101 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+public class GenException<T> : Exception {}
+
+public struct Gen
+{
+ public static void ExceptionTest<Ex>(Ex e) where Ex : Exception
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ExceptionTest<Exception>(new Exception());
+ Gen.ExceptionTest<Exception>(new InvalidOperationException());
+ Gen.ExceptionTest<Exception>(new GenException<int>());
+ Gen.ExceptionTest<Exception>(new GenException<string>());
+ Gen.ExceptionTest<Exception>(new GenException<Guid>());
+ Gen.ExceptionTest<Exception>(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ Gen.ExceptionTest<InvalidOperationException>(new InvalidOperationException());
+
+ Gen.ExceptionTest<GenException<int>>(new GenException<int>());
+ Gen.ExceptionTest<GenException<string>>(new GenException<string>());
+ Gen.ExceptionTest<GenException<Guid>>(new GenException<Guid>());
+ Gen.ExceptionTest<GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>>(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter007.cs b/tests/src/baseservices/exceptions/generics/typeparameter007.cs
new file mode 100644
index 0000000000..5f4add9696
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter007.cs
@@ -0,0 +1,101 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+public class GenException<T> : Exception {}
+
+public class Gen
+{
+ public void ExceptionTest<Ex>(Ex e) where Ex : Exception
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen().ExceptionTest<Exception>(new Exception());
+ new Gen().ExceptionTest<Exception>(new InvalidOperationException());
+ new Gen().ExceptionTest<Exception>(new GenException<int>());
+ new Gen().ExceptionTest<Exception>(new GenException<string>());
+ new Gen().ExceptionTest<Exception>(new GenException<Guid>());
+ new Gen().ExceptionTest<Exception>(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ new Gen().ExceptionTest<InvalidOperationException>(new InvalidOperationException());
+
+ new Gen().ExceptionTest<GenException<int>>(new GenException<int>());
+ new Gen().ExceptionTest<GenException<string>>(new GenException<string>());
+ new Gen().ExceptionTest<GenException<Guid>>(new GenException<Guid>());
+ new Gen().ExceptionTest<GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>>(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter008.cs b/tests/src/baseservices/exceptions/generics/typeparameter008.cs
new file mode 100644
index 0000000000..8c2ab03de3
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter008.cs
@@ -0,0 +1,101 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public struct ValX0 {}
+public struct ValY0 {}
+public struct ValX1<T> {}
+public struct ValY1<T> {}
+public struct ValX2<T,U> {}
+public struct ValY2<T,U>{}
+public struct ValX3<T,U,V>{}
+public struct ValY3<T,U,V>{}
+public class RefX0 {}
+public class RefY0 {}
+public class RefX1<T> {}
+public class RefY1<T> {}
+public class RefX2<T,U> {}
+public class RefY2<T,U>{}
+public class RefX3<T,U,V>{}
+public class RefY3<T,U,V>{}
+
+
+public class GenException<T> : Exception {}
+
+public struct Gen
+{
+ public void ExceptionTest<Ex>(Ex e) where Ex : Exception
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen().ExceptionTest<Exception>(new Exception());
+ new Gen().ExceptionTest<Exception>(new InvalidOperationException());
+ new Gen().ExceptionTest<Exception>(new GenException<int>());
+ new Gen().ExceptionTest<Exception>(new GenException<string>());
+ new Gen().ExceptionTest<Exception>(new GenException<Guid>());
+ new Gen().ExceptionTest<Exception>(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ new Gen().ExceptionTest<InvalidOperationException>(new InvalidOperationException());
+
+ new Gen().ExceptionTest<GenException<int>>(new GenException<int>());
+ new Gen().ExceptionTest<GenException<string>>(new GenException<string>());
+ new Gen().ExceptionTest<GenException<Guid>>(new GenException<Guid>());
+ new Gen().ExceptionTest<GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>>(new GenException<ValX3<ValX1<int[][,,,]>,ValX2<object[,,,][][],Guid[][][]>,ValX3<double[,,,,,,,,,,],Guid[][][][,,,,][,,,,][][][],string[][][][][][][][][][][]>>>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter009.cs b/tests/src/baseservices/exceptions/generics/typeparameter009.cs
new file mode 100644
index 0000000000..1850e39759
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter009.cs
@@ -0,0 +1,75 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public class GenException<T> : Exception {}
+
+public class GenExceptionSub<T> : GenException<T> {}
+
+public class Gen<Ex,T> where Ex : GenException<T>
+{
+ public static void ExceptionTest(Ex e)
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<GenException<int>,int>.ExceptionTest(new GenExceptionSub<int>());
+ Gen<GenException<string>,string>.ExceptionTest(new GenExceptionSub<string>());
+ Gen<GenException<Guid>,Guid>.ExceptionTest(new GenExceptionSub<Guid>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter010.cs b/tests/src/baseservices/exceptions/generics/typeparameter010.cs
new file mode 100644
index 0000000000..b4e58b36fc
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter010.cs
@@ -0,0 +1,75 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public class GenException<T> : Exception {}
+
+public class GenExceptionSub<T> : GenException<T> {}
+
+public struct Gen<Ex,T> where Ex : GenException<T>
+{
+ public static void ExceptionTest(Ex e)
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<GenException<int>,int>.ExceptionTest(new GenExceptionSub<int>());
+ Gen<GenException<string>,string>.ExceptionTest(new GenExceptionSub<string>());
+ Gen<GenException<Guid>,Guid>.ExceptionTest(new GenExceptionSub<Guid>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter011.cs b/tests/src/baseservices/exceptions/generics/typeparameter011.cs
new file mode 100644
index 0000000000..1850e39759
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter011.cs
@@ -0,0 +1,75 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public class GenException<T> : Exception {}
+
+public class GenExceptionSub<T> : GenException<T> {}
+
+public class Gen<Ex,T> where Ex : GenException<T>
+{
+ public static void ExceptionTest(Ex e)
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<GenException<int>,int>.ExceptionTest(new GenExceptionSub<int>());
+ Gen<GenException<string>,string>.ExceptionTest(new GenExceptionSub<string>());
+ Gen<GenException<Guid>,Guid>.ExceptionTest(new GenExceptionSub<Guid>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter012.cs b/tests/src/baseservices/exceptions/generics/typeparameter012.cs
new file mode 100644
index 0000000000..12e0d70d1d
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter012.cs
@@ -0,0 +1,75 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public class GenException<T> : Exception {}
+
+public class GenExceptionSub<T> : GenException<T> {}
+
+public struct Gen<Ex,T> where Ex : GenException<T>
+{
+ public void ExceptionTest(Ex e)
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<GenException<int>,int>().ExceptionTest(new GenExceptionSub<int>());
+ new Gen<GenException<string>,string>().ExceptionTest(new GenExceptionSub<string>());
+ new Gen<GenException<Guid>,Guid>().ExceptionTest(new GenExceptionSub<Guid>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter013.cs b/tests/src/baseservices/exceptions/generics/typeparameter013.cs
new file mode 100644
index 0000000000..67b6bdf9bd
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter013.cs
@@ -0,0 +1,75 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public class GenException<T> : Exception {}
+
+public class GenExceptionSub<T> : GenException<T> {}
+
+public class Gen
+{
+ public static void ExceptionTest<Ex,T>(Ex e) where Ex : GenException<T>
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ExceptionTest<GenException<int>,int>(new GenExceptionSub<int>());
+ Gen.ExceptionTest<GenException<string>,string>(new GenExceptionSub<string>());
+ Gen.ExceptionTest<GenException<Guid>,Guid>(new GenExceptionSub<Guid>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter014.cs b/tests/src/baseservices/exceptions/generics/typeparameter014.cs
new file mode 100644
index 0000000000..5807b278ac
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter014.cs
@@ -0,0 +1,75 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public class GenException<T> : Exception {}
+
+public class GenExceptionSub<T> : GenException<T> {}
+
+public struct Gen
+{
+ public static void ExceptionTest<Ex,T>(Ex e) where Ex : GenException<T>
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ExceptionTest<GenException<int>,int>(new GenExceptionSub<int>());
+ Gen.ExceptionTest<GenException<string>,string>(new GenExceptionSub<string>());
+ Gen.ExceptionTest<GenException<Guid>,Guid>(new GenExceptionSub<Guid>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter015.cs b/tests/src/baseservices/exceptions/generics/typeparameter015.cs
new file mode 100644
index 0000000000..687260a14f
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter015.cs
@@ -0,0 +1,75 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public class GenException<T> : Exception {}
+
+public class GenExceptionSub<T> : GenException<T> {}
+
+public class Gen
+{
+ public void ExceptionTest<Ex,T>(Ex e) where Ex : GenException<T>
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen().ExceptionTest<GenException<int>,int>(new GenExceptionSub<int>());
+ new Gen().ExceptionTest<GenException<string>,string>(new GenExceptionSub<string>());
+ new Gen().ExceptionTest<GenException<Guid>,Guid>(new GenExceptionSub<Guid>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter016.cs b/tests/src/baseservices/exceptions/generics/typeparameter016.cs
new file mode 100644
index 0000000000..b5b744ccd0
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter016.cs
@@ -0,0 +1,75 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> </RelatedBugs>
+
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public class GenException<T> : Exception {}
+
+public class GenExceptionSub<T> : GenException<T> {}
+
+public struct Gen
+{
+ public void ExceptionTest<Ex,T>(Ex e) where Ex : GenException<T>
+ {
+ try
+ {
+ throw e;
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+ }
+ catch
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen().ExceptionTest<GenException<int>,int>(new GenExceptionSub<int>());
+ new Gen().ExceptionTest<GenException<string>,string>(new GenExceptionSub<string>());
+ new Gen().ExceptionTest<GenException<Guid>,Guid>(new GenExceptionSub<Guid>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter017.cs b/tests/src/baseservices/exceptions/generics/typeparameter017.cs
new file mode 100644
index 0000000000..cbc37f6182
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter017.cs
@@ -0,0 +1,79 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> VSW48886 </RelatedBugs>
+
+//<Expects Status=skip> </Expects>
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public class GenException<T> : Exception {}
+
+public class Gen
+{
+ public static void ExceptionTest<Ex,T>(Ex e) where Ex : Exception where T : Exception
+ {
+ try
+ {
+ throw e;
+ }
+ catch(T)
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ExceptionTest<Exception,InvalidOperationException>(new Exception());
+ Gen.ExceptionTest<Exception,GenException<int>>(new Exception());
+ Gen.ExceptionTest<Exception,GenException<string>>(new Exception());
+ Gen.ExceptionTest<GenException<int>,GenException<string>>(new GenException<int>());
+ Gen.ExceptionTest<GenException<string>,GenException<int>>(new GenException<string>());
+ Gen.ExceptionTest<GenException<object>,GenException<string>>(new GenException<object>());
+ Gen.ExceptionTest<GenException<string>,GenException<object>>(new GenException<string>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/generics/typeparameter018.cs b/tests/src/baseservices/exceptions/generics/typeparameter018.cs
new file mode 100644
index 0000000000..89a2ceb38c
--- /dev/null
+++ b/tests/src/baseservices/exceptions/generics/typeparameter018.cs
@@ -0,0 +1,79 @@
+// 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.
+// <Area> Generics - Expressions - specific catch clauses </Area>
+// <Title>
+// catch type parameters bound by Exception or a subclass of it in the form catch(T)
+// </Title>
+// <RelatedBugs> VSW 48886 </RelatedBugs>
+
+//<Expects Status=skip></Expects>
+//<Expects Status=success></Expects>
+
+// <Code>
+
+using System;
+
+public class GenException<T> : Exception {}
+
+public struct Gen
+{
+ public static void ExceptionTest<Ex,T>(Ex e) where Ex : Exception where T : Exception
+ {
+ try
+ {
+ throw e;
+ }
+ catch(T)
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ExceptionTest<Exception,InvalidOperationException>(new Exception());
+ Gen.ExceptionTest<Exception,GenException<int>>(new Exception());
+ Gen.ExceptionTest<Exception,GenException<string>>(new Exception());
+ Gen.ExceptionTest<GenException<int>,GenException<string>>(new GenException<int>());
+ Gen.ExceptionTest<GenException<string>,GenException<int>>(new GenException<string>());
+ Gen.ExceptionTest<GenException<object>,GenException<string>>(new GenException<object>());
+ Gen.ExceptionTest<GenException<string>,GenException<object>>(new GenException<string>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
+
+// </Code>
diff --git a/tests/src/baseservices/exceptions/regressions/Dev11/147911/CMakeLists.txt b/tests/src/baseservices/exceptions/regressions/Dev11/147911/CMakeLists.txt
new file mode 100644
index 0000000000..1bbbd915d2
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/Dev11/147911/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required (VERSION 2.6)
+if(WIN32)
+project (fpcw)
+include_directories(${INC_PLATFORM_DIR})
+
+# add the executable
+add_library (fpcw SHARED fpcw.cpp)
+
+# add the install targets
+install (TARGETS fpcw DESTINATION bin)
+endif()
diff --git a/tests/src/baseservices/exceptions/regressions/Dev11/147911/fpcw.cpp b/tests/src/baseservices/exceptions/regressions/Dev11/147911/fpcw.cpp
new file mode 100644
index 0000000000..f8e581a769
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/Dev11/147911/fpcw.cpp
@@ -0,0 +1,206 @@
+// 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.
+
+
+// FPCW.cpp : Defines the exported functions for the DLL application.
+//
+
+#include "fpcw.h"
+#include <stdio.h>
+#include <float.h>
+
+LONG WINAPI ExcepFilter(struct _EXCEPTION_POINTERS *pExp)
+{
+ printf( "In ExcepFilter \n" );
+
+ if (pExp->ExceptionRecord->ExceptionCode == 0xc00002b5 ||
+ pExp->ExceptionRecord->ExceptionCode == 0xc00002b4 )
+ return EXCEPTION_EXECUTE_HANDLER;
+ else
+ return EXCEPTION_CONTINUE_SEARCH;
+}
+
+
+// This is an example of an exported function.
+// Disable optimization otherwise compiler removes dividebyzero operation
+#pragma optimize( "", off )
+extern "C" FPCW_API int RaiseFPException(void)
+{
+ unsigned int fpcw;
+
+ // DivByZero
+ printf("DivByZero: ");
+
+ // Enable all FP exceptions
+ int err = _controlfp_s(&fpcw, 0, _MCW_EM);
+ if (err)
+ {
+ printf("Error setting FPCW: %d\n", err);
+ return -1;
+ }
+
+ __try
+ {
+ __try
+ {
+ float d = 2.0 - (0.0+2.0);
+ float f = 2.0f/d;
+ printf("Shouldn't execute!\n");
+ (void)f; // nop to disable warning C4189
+ return 99;
+ }
+ __except((GetExceptionCode()==0xc000008e)?EXCEPTION_EXECUTE_HANDLER:EXCEPTION_CONTINUE_SEARCH)
+ {
+ printf("Caught exception!\n");
+
+ // Clear FPSW else the "waiting" FPU instructions used in _controlfp_s will result in
+ // FPU raising the exception again.
+ _clearfp();
+
+ // Reset FPCW
+ err = _controlfp_s(&fpcw, 0x1f, _MCW_EM);
+ if (err)
+ {
+ printf("Error setting FPCW: %d\n", err);
+ return -1;
+ }
+
+ printf("Passed\n");
+ }
+ }
+ __except(ExcepFilter(GetExceptionInformation()))
+ {
+ printf("Caught exception in Filter!\n");
+
+ // Clear FPSW else the "waiting" FPU instructions used in _controlfp_s will result in
+ // FPU raising the exception again.
+ _clearfp();
+
+ // Reset FPCW
+ err = _controlfp_s(&fpcw, 0x1f, _MCW_EM);
+ if (err)
+ {
+ printf("Error setting FPCW: %d\n", err);
+ return -1;
+ }
+ }
+
+
+ // Underflow
+ printf("Underflow: ");
+
+ // Enable all FP exceptions
+ err = _controlfp_s(&fpcw, 0, _MCW_EM);
+ if (err)
+ {
+ printf("Error setting FPCW: %d\n", err);
+ return -1;
+ }
+
+ __try
+ {
+ __try
+ {
+ double a = 1e-40, b;
+ float y;
+ y = (float)a;
+ b = 2.0;
+ printf("Shouldn't execute!\n");
+ return 98;
+ }
+ __except((GetExceptionCode()==0xc0000093)?EXCEPTION_EXECUTE_HANDLER:EXCEPTION_CONTINUE_SEARCH)
+ {
+ printf("Caught exception!\n");
+
+ // Clear FPSW else the "waiting" FPU instructions used in _controlfp_s will result in
+ // FPU raising the exception again.
+ _clearfp();
+
+ // Reset FPCW
+ err = _controlfp_s(&fpcw, 0x1f, _MCW_EM);
+ if (err)
+ {
+ printf("Error setting FPCW: %d\n", err);
+ return -1;
+ }
+ printf("Passed\n");
+ }
+ }
+ __except(ExcepFilter(GetExceptionInformation()))
+ {
+ printf("Caught exception in Filter!\n");
+ // Clear FPSW else the "waiting" FPU instructions used in _controlfp_s will result in
+ // FPU raising the exception again.
+ _clearfp();
+
+ // Reset FPCW
+ err = _controlfp_s(&fpcw, 0x1f, _MCW_EM);
+ if (err)
+ {
+ printf("Error setting FPCW: %d\n", err);
+ return -1;
+ }
+ }
+
+ // Overflow
+ printf("Overflow: ");
+
+ // Enable all FP exceptions
+ err = _controlfp_s(&fpcw, 0, _MCW_EM);
+ if (err)
+ {
+ printf("Error setting FPCW: %d\n", err);
+ return -1;
+ }
+
+ __try
+ {
+ __try
+ {
+ double a = 1e+40, b;
+ float y;
+ y = (float)a;
+ b = 2.0;
+ printf("Shouldn't execute!\n");
+ return 97;
+ }
+ __except((GetExceptionCode()==0xc0000091)?EXCEPTION_EXECUTE_HANDLER:EXCEPTION_CONTINUE_SEARCH)
+ {
+ printf("Caught exception!\n");
+
+ // Clear FPSW else the "waiting" FPU instructions used in _controlfp_s will result in
+ // FPU raising the exception again.
+ _clearfp();
+
+ // Reset FPCW
+ err = _controlfp_s(&fpcw, 0x1f, _MCW_EM);
+ if (err)
+ {
+ printf("Error setting FPCW: %d\n", err);
+ return -1;
+ }
+ printf("Passed\n");
+ }
+ }
+ __except(ExcepFilter(GetExceptionInformation()))
+ {
+ printf("Caught exception in Filter!\n");
+
+ // Clear FPSW else the "waiting" FPU instructions used in _controlfp_s will result in
+ // FPU raising the exception again.
+ _clearfp();
+
+ // Reset FPCW
+ err = _controlfp_s(&fpcw, 0x1f, _MCW_EM);
+ if (err)
+ {
+ printf("Error setting FPCW: %d\n", err);
+ return -1;
+ }
+ }
+
+
+ return 100;
+}
+
diff --git a/tests/src/baseservices/exceptions/regressions/Dev11/147911/fpcw.h b/tests/src/baseservices/exceptions/regressions/Dev11/147911/fpcw.h
new file mode 100644
index 0000000000..e0990567de
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/Dev11/147911/fpcw.h
@@ -0,0 +1,19 @@
+// 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.
+
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the FPCW_EXPORTS
+// symbol defined on the command line. This symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// FPCW_API functions as being imported from a DLL, whereas this DLL sees symbols
+// defined with this macro as being exported.
+#define FPCW_API __declspec(dllexport)
+
+extern "C" FPCW_API int RaiseFPException(void);
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+// Windows Header Files:
+#include <windows.h> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/Dev11/147911/test147911.cs b/tests/src/baseservices/exceptions/regressions/Dev11/147911/test147911.cs
new file mode 100644
index 0000000000..045f3a1938
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/Dev11/147911/test147911.cs
@@ -0,0 +1,20 @@
+// 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.Runtime.InteropServices;
+
+
+public class Class1
+{
+ [DllImport("fpcw.dll")]
+ private static extern int RaiseFPException();
+
+ public static int Main(string[] args)
+ {
+ int retVal = RaiseFPException();
+
+ return ( retVal==100 ) ? 100 : 101;
+ }
+}
diff --git a/tests/src/baseservices/exceptions/regressions/Dev11/147911/test147911.csproj b/tests/src/baseservices/exceptions/regressions/Dev11/147911/test147911.csproj
new file mode 100644
index 0000000000..a8c40a1478
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/Dev11/147911/test147911.csproj
@@ -0,0 +1,47 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="test147911.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="CMakeLists.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/Dev11/154243/dynamicmethodliveness.cs b/tests/src/baseservices/exceptions/regressions/Dev11/154243/dynamicmethodliveness.cs
new file mode 100644
index 0000000000..5592a9c7e7
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/Dev11/154243/dynamicmethodliveness.cs
@@ -0,0 +1,99 @@
+// 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.
+
+// regression test for Devdiv bug 154243
+// the test passes if we get to Done.
+// with the bug present test was getting assert dialog box with message that Consistency check failed: FAILED: state.fFound
+
+using System;
+using System.Threading;
+using System.Reflection;
+using System.Reflection.Emit;
+
+public class My {
+
+ static Exception theException = new Exception();
+
+ static void Thrower() {
+ for (int j = 0; j <= 100; j++)
+ {
+ try {
+ throw theException;
+ }
+ catch {
+ }
+ }
+ }
+
+ static void Dynamizer() {
+ for (int j = 0; j <= 100; j++)
+ {
+ DynamicMethod method = EmitDynamicMethod(typeof(My).GetMethod("Noop"));
+ ((Action)method.CreateDelegate(typeof(Action)))();
+ }
+ }
+
+ static DynamicMethod EmitDynamicMethod(MethodInfo callee)
+ {
+ DynamicMethod method = new DynamicMethod(
+ "MyMethod",
+ typeof(void),
+ new Type[0],
+ typeof(My).GetTypeInfo().Module);
+
+ ILGenerator il = method.GetILGenerator();
+ for (int i = 0; i < 5; i++)
+ il.Emit(OpCodes.Call, callee);
+ il.Emit(OpCodes.Ret);
+
+ return method;
+ }
+
+ public static void ThrowException() {
+ throw theException;
+ }
+
+ public static void Noop() {
+ }
+
+ static void DoStuff() {
+ DynamicMethod method = EmitDynamicMethod(typeof(My).GetMethod("ThrowException"));
+ for (int i = 0; i < 20; i++)
+ method = EmitDynamicMethod(method);
+ ((Action)method.CreateDelegate(typeof(Action)))();
+ }
+
+ static int Main() {
+ new Thread(Thrower).Start();
+
+ new Thread(Dynamizer).Start();
+
+ Thread.Sleep(100);
+ Console.WriteLine("TestCase Started");
+ for (int j=0;j<=100;j++) {
+ Console.WriteLine("Counter = " + j.ToString());
+ try {
+ try {
+
+ DoStuff();
+ }
+ finally {
+ Console.WriteLine("Sleeping");
+ Thread.Sleep(100);
+ Console.WriteLine("Running GC");
+ GC.Collect();
+ Console.WriteLine("Waiting for finalizers...");
+ for (int i = 0; i < 10; i++) GC.WaitForPendingFinalizers();
+ Console.WriteLine("Running GC");
+ GC.Collect();
+ }
+ }
+ catch (Exception)
+ {
+ }
+ }
+ Console.WriteLine("Test case Pass");
+ return 100;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/Dev11/154243/dynamicmethodliveness.csproj b/tests/src/baseservices/exceptions/regressions/Dev11/154243/dynamicmethodliveness.csproj
new file mode 100644
index 0000000000..2ac58fc9dc
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/Dev11/154243/dynamicmethodliveness.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="dynamicmethodliveness.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/finally.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/finally.cs
new file mode 100644
index 0000000000..1e13b966ba
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/finally.cs
@@ -0,0 +1,40 @@
+// 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.Threading;
+public class Foo
+{
+ private static int n=0;
+
+ public static void Bar(){
+ int i = 0;
+ try {
+ i = i/n ;
+ }
+ catch(DivideByZeroException)
+ {}
+ finally { n++;
+ Console.WriteLine("In finally " + i);
+ }
+ }
+
+ public static int Main(String[] args)
+ {
+ String s = "Done";
+ Thread t = new Thread(new ThreadStart(Foo.Bar));
+ t.Start();
+ //Thread MainThread = Thread.CurrentThread;
+ Thread.Sleep(1000);
+ if (n == 2){
+ Console.WriteLine("Finally Test failed");
+ return 1;
+ }
+ else {
+ Console.WriteLine("Test Passed");
+ Console.WriteLine(s);
+ return 100;
+ }
+ }
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/finally.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/finally.csproj
new file mode 100644
index 0000000000..700fd91d5c
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/finally.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="finally.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/rethrow.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/rethrow.cs
new file mode 100644
index 0000000000..7ea776fbb6
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/rethrow.cs
@@ -0,0 +1,147 @@
+// 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.Threading;
+
+public class UserException1 : Exception {
+ int ExceptionId;
+
+ public UserException1()
+ {
+ }
+
+ public UserException1(int id){
+ ExceptionId = id;
+ }
+
+public class UserException2 : UserException1 {
+ new int ExceptionId;
+
+ public UserException2()
+ {
+ }
+ public UserException2(int id) : base(id)
+ {
+ ExceptionId = id;
+ }
+
+public class UserException3 : UserException2 {
+ new int ExceptionId;
+
+ public UserException3()
+ {
+ }
+
+ public UserException3(int id) : base(id)
+ {
+ ExceptionId = id;
+ }
+
+public class UserException4 : UserException3 {
+ new int ExceptionId;
+
+ public UserException4()
+ {
+ }
+ public UserException4(int id) : base(id)
+ {
+ ExceptionId = id;
+ }
+
+public class RethrowException {
+ private int ThreadId;
+
+ public RethrowException(int id){
+ ThreadId = id;
+ }
+
+
+ public static int Main(String[] args) {
+ String s = "Done";
+ System.IO.TextWriter t = Console.Out;
+ Console.SetOut(t);
+ int retVal = 101;
+ Thread[] mv_Thread = new Thread[10];
+ RethrowException[] he = new RethrowException[12];
+ for (int i = 0 ; i < 10 ; i++){
+ he[i] = new RethrowException(i);
+ mv_Thread[i] = new Thread(new ThreadStart(he[i].runtest));
+ try {
+ mv_Thread[i].Start();
+ }
+ catch (Exception ){
+ Console.WriteLine("Exception was caught in main");
+ }
+ }
+ for (int i = 0; i < 10; i++){
+ mv_Thread[i].Join();
+ }
+ Console.WriteLine("\n\n Test Passed");
+ Console.WriteLine(s);
+ retVal = 100;
+ return retVal;
+ }
+
+ public void runtest(){
+ try {
+ try {
+ try {
+ try {
+ switch (ThreadId % 4){
+ case 0: throw new UserException1(ThreadId);
+ case 1: throw new UserException2(ThreadId);
+ case 2: throw new UserException3(ThreadId);
+ case 3: throw new UserException4(ThreadId);
+ default:
+ throw new Exception();
+ }
+
+ }
+ catch (UserException4 e){
+ lock(this)
+ {
+ Console.WriteLine("Exception4 was caught by Thread " + e.ExceptionId );
+ throw ;
+ }
+ }
+ }
+ catch (UserException3 e) {
+ lock(this)
+ {
+ Console.WriteLine("Exception3 was caught by Thread " + e.ExceptionId );
+ throw ;
+ }
+
+ }
+ }
+ catch (UserException2 e){
+ lock(this)
+ {
+ Console.WriteLine("Exception2 was caught by Thread " + e.ExceptionId );
+ throw ;
+ }
+ }
+ }
+ catch (UserException1 e) {
+ lock(this)
+ {
+ Console.WriteLine("Exception1 was caught by Thread " + e.ExceptionId );
+ }
+ }
+ catch (Exception ){
+ lock(this)
+ {
+ Console.WriteLine("Exception was caught");
+ }
+ }
+
+ }
+
+} // REthrow
+} //UserException1
+} //UserException2
+} //UserException3
+} //UserException4
+
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/rethrow.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/rethrow.csproj
new file mode 100644
index 0000000000..21c3b2effd
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/COOL/rethrow.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="rethrow.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/CMakeLists.txt b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/CMakeLists.txt
new file mode 100644
index 0000000000..fa7315e4c7
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required (VERSION 2.6)
+if (WIN32)
+project (Unmanaged)
+include_directories(${INC_PLATFORM_DIR})
+
+# add the executable
+add_library (Unmanaged SHARED Unmanaged.cpp)
+
+# add the install targets
+install (TARGETS Unmanaged DESTINATION bin)
+endif()
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/ExternalException.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/ExternalException.cs
new file mode 100644
index 0000000000..3c56d933dc
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/ExternalException.cs
@@ -0,0 +1,86 @@
+// 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.Threading;
+
+class ExternalClass {
+ ExternalException ee = new ExternalException();
+
+ public void ThrowException(){
+ throw ee;
+ }
+
+}
+
+
+public class ExternalException : Exception {
+
+ static int retVal = 100;
+
+ public static int Main(String [] args) {
+ Thread mv_Thread;
+ String str = "Done";
+ ExternalException ee = new ExternalException();
+ for (int i = 0 ; i < 10; i++){
+ mv_Thread = new Thread(new ThreadStart(ee.runtest));
+ try {
+ mv_Thread.Start();
+ }
+ catch (Exception ){
+ Console.WriteLine("Exception was caught in main");
+ }
+ }
+ Console.WriteLine(str);
+ return retVal;
+ }
+
+ public void runtest(){
+ int counter = 0;
+ //String m_str = "Failed";
+ for (int j = 0; j < 100; j++){
+ try {
+ if (j % 2 == 0)
+ counter = j / (j % 2);
+ else
+ recurse(0);
+ }
+ catch ( ArithmeticException ) {
+ counter++;
+ continue;
+ }
+ catch (ExternalException ){
+ counter--;
+ continue;
+ }
+ finally {
+ counter++;
+ }
+ }
+ if (counter == 100){
+ lock(this) {
+ Console.WriteLine( "TryCatch Test Passed" );
+ }
+ }
+ else{
+ lock(this) {
+ Console.WriteLine( "TryCatch Test Failed" );
+ Console.WriteLine(counter);
+ retVal = -1;
+ }
+ }
+ }
+
+ public void recurse(int counter){
+ char [] abc = new char[100];
+ if (counter == 100)
+ (new ExternalClass()).ThrowException();
+ else
+ recurse(++counter);
+
+ }
+}
+
+
+
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/ExternalException.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/ExternalException.csproj
new file mode 100644
index 0000000000..33193a8a95
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/ExternalException.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ExternalException.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/HandlerException.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/HandlerException.cs
new file mode 100644
index 0000000000..9f9547a2cc
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/HandlerException.cs
@@ -0,0 +1,123 @@
+// 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.Threading;
+using System.IO;
+
+class UserException1 : Exception {
+ public int ExceptionId;
+
+ public UserException1(int id){
+ ExceptionId = id;
+ }
+}
+
+class UserException2 : Exception {
+ public int ExceptionId;
+
+ public UserException2(int id){
+ ExceptionId = id;
+ }
+}
+
+class UserException3 : Exception {
+ public int ExceptionId;
+
+ public UserException3(int id){
+ ExceptionId = id;
+ }
+}
+
+class UserException4 : Exception {
+ public int ExceptionId;
+
+ public UserException4(int id){
+ ExceptionId = id;
+ }
+}
+
+
+public class HandlerException {
+ private int ThreadId;
+
+ public HandlerException(int id){
+ ThreadId = id;
+ }
+
+
+ public static int Main(String [] args) {
+ String s = "Done";
+ int retVal = 100;
+ Thread mv_Thread;
+ HandlerException [] he = new HandlerException[10];
+ for (int i = 0 ; i < 10; i++){
+ he[i] = new HandlerException(i);
+ mv_Thread = new Thread(new ThreadStart(he[i].runtest));
+ try {
+ mv_Thread.Start();
+ }
+ catch (Exception ){
+ Console.WriteLine("Exception was caught in main");
+ retVal = 0;
+ }
+ }
+ Console.WriteLine(s);
+ return retVal;
+ }
+
+ public void runtest(){
+ try {
+ try {
+ try {
+ try {
+ switch (ThreadId){
+ case 0: throw new UserException1(ThreadId);
+ case 1: throw new UserException2(ThreadId);
+ case 2: throw new UserException3(ThreadId);
+ case 3: throw new UserException4(ThreadId);
+ default:
+ throw new Exception();
+ }
+
+ }
+ catch (UserException1 e){
+ lock(this)
+ {
+ Console.WriteLine("Exception1 was caught by Thread " + e.ExceptionId );
+ }
+
+ throw new UserException2(ThreadId);
+ }
+ }
+ catch (UserException2 e) {
+ lock(this)
+ {
+ Console.WriteLine("Exception2 was caught by Thread " + e.ExceptionId );
+ }
+ throw new UserException3(ThreadId);
+ }
+ }
+ catch (UserException3 e){
+ lock(this)
+ {
+ Console.WriteLine("Exception3 was caught by Thread " + e.ExceptionId );
+ }
+ throw new UserException4(ThreadId);
+ }
+ }
+ catch (UserException4 e) {
+ lock(this)
+ {
+ Console.WriteLine("Exception4 was caught by Thread " + e.ExceptionId );
+ }
+ }
+ catch (Exception ){
+ lock(this)
+ {
+ Console.WriteLine("Exception was caught");
+ }
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/HandlerException.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/HandlerException.csproj
new file mode 100644
index 0000000000..63483b96b5
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/HandlerException.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="HandlerException.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/MultipleException.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/MultipleException.cs
new file mode 100644
index 0000000000..3a8706ba1f
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/MultipleException.cs
@@ -0,0 +1,61 @@
+// 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.Threading;
+using System.IO;
+
+class UserException : Exception {
+ internal int ExceptionId;
+
+ public UserException(int id){
+ ExceptionId = id;
+ }
+}
+
+public class MultipleException {
+ private int ThreadId;
+
+ public MultipleException(int id){
+ ThreadId = id;
+ }
+
+
+ public static int Main(String [] args) {
+ int retVal = 100;
+ String s = "Done";
+ Thread mv_Thread;
+ MultipleException [] me = new MultipleException[10];
+ for (int i = 0 ; i < 10; i++){
+ me[i] = new MultipleException(i);
+ mv_Thread = new Thread(new ThreadStart(me[i].runtest));
+ try {
+ mv_Thread.Start();
+ }
+ catch (Exception ){
+ Console.WriteLine("Exception was caught in main");
+ retVal = 0;
+ }
+ }
+ Console.WriteLine(s);
+ return retVal;
+ }
+
+ public void runtest(){
+ try {
+ recurse(0);
+ }
+ catch (UserException e) {
+ lock(this){
+ Console.WriteLine("The Exception " + e.ExceptionId + " was caught");
+ }
+ }
+ }
+
+ public void recurse(int counter) {
+ if (counter == 1000)
+ throw new UserException( ThreadId );
+ else
+ recurse(++counter);
+ }
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/MultipleException.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/MultipleException.csproj
new file mode 100644
index 0000000000..9b4caf3a6e
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/MultipleException.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="MultipleException.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx1.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx1.cs
new file mode 100644
index 0000000000..d659706540
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx1.cs
@@ -0,0 +1,126 @@
+// 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.Security;
+
+class TestClass {
+
+ static int iExitCode;
+
+ void TestMain()
+ {
+ int caught = 0;
+ int fincount = 0;
+
+ try {
+ throw new ArgumentException();
+// Console.WriteLine("Exception not thrown.");
+// iExitCode = 1;
+ }
+ catch (ArithmeticException ) {
+ Console.WriteLine("Caught wrong exception.");
+ iExitCode = 2;
+ }
+ catch (ArgumentException ) {
+ caught ++;
+ try {
+ throw new SecurityException();
+// Console.WriteLine("Exception not thrown.");
+// iExitCode = 1;
+ }
+ catch (SecurityException ) {
+ caught ++;
+ }
+ catch (Exception ) {
+ Console.WriteLine("Didn't catch specific exception.");
+ iExitCode = 3;
+ }
+ finally {
+ try{
+ throw new NullReferenceException();
+// Console.WriteLine("Exception Not Thrown in Finally");
+ }
+ catch(NullReferenceException e){
+ Console.WriteLine(e.StackTrace);
+ caught++;
+ }
+ catch(Exception ){
+ Console.WriteLine("Correct Exception not caught");
+ }
+ finally
+ {
+ GC.Collect();
+ fincount++;
+ }
+
+ fincount ++;
+ }
+ }
+ catch (Exception ) {
+ Console.WriteLine("Didn't catch specific exception.");
+ iExitCode = 3;
+ }
+ finally {
+ GC.Collect();
+ fincount ++;
+ }
+
+ try {
+ try {
+ throw new NullReferenceException();
+// Console.WriteLine("Exception not thrown.");
+// iExitCode = 1;
+ }
+ catch (NullReferenceException ) {
+ caught ++;
+ throw new OutOfMemoryException();
+// Console.WriteLine("Exception not thrown.");
+// iExitCode = 1;
+ }
+ catch (Exception ) {
+ Console.WriteLine("Didn't catch specific exception.");
+ iExitCode = 3;
+ }
+ finally {
+ GC.Collect();
+ fincount ++;
+ }
+ }
+ catch (OutOfMemoryException ) {
+ caught ++;
+ }
+ finally {
+ GC.Collect();
+ fincount ++;
+ }
+
+ if (caught != 5) {
+ Console.WriteLine("Didn't catch enough exceptions.");
+ iExitCode = 4;
+ }
+ if (fincount != 5) {
+ Console.WriteLine("Didn't execute enough finallys.");
+ iExitCode = 5;
+ }
+ }
+
+ public static int Main(String [] args)
+ {
+ int retVal = 100;
+ String str = "Done";
+ (new TestClass()).TestMain();
+ if (iExitCode == 0) {
+ Console.WriteLine("Test Passed.");
+ } else {
+ Console.WriteLine("Test FAILED.");
+ retVal = iExitCode;
+ }
+ Console.WriteLine(str);
+ return retVal;
+}
+
+};
+
+
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx1.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx1.csproj
new file mode 100644
index 0000000000..9cc92f0cf9
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx1.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="NestedEx1.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx2.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx2.cs
new file mode 100644
index 0000000000..d95d8b5dcc
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx2.cs
@@ -0,0 +1,178 @@
+// 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.Security;
+
+class TestClass {
+
+ static int iExitCode;
+
+ void TestMain()
+ {
+ int caught = 0;
+ int fincount = 0;
+
+ try {
+ throw new ArgumentException();
+// Console.WriteLine("Exception not thrown.");
+// iExitCode = 1;
+ }
+ catch (ArithmeticException ) {
+ Console.WriteLine("Caught wrong exception.");
+ iExitCode = 2;
+ }
+ catch (ArgumentException ) {
+ caught ++;
+ try {
+ try{
+ try{
+ try{
+ try{
+ try{
+ try{
+ try{
+ int [] arr = new int[1000];
+ throw new SecurityException();
+// Console.WriteLine("Exception not thrown.");
+// iExitCode = 1;
+ }
+ catch(DivideByZeroException ){
+ }
+ finally
+ {
+ double [] s = new double[1];
+ }
+
+ }
+ catch(DivideByZeroException ){
+ }
+ }
+ catch(DivideByZeroException ){
+ }
+ finally
+ {
+ Console.WriteLine("Somewhere in a finally");
+ float [] j = new float[99];
+ }
+
+ }
+ catch(DivideByZeroException ){
+ }
+ }
+ catch(DivideByZeroException ){
+ }
+ }
+ catch(DivideByZeroException ){
+ }
+ }
+ catch(DivideByZeroException ){
+ }
+ }
+ catch(DivideByZeroException ){
+ }
+ catch (SecurityException ) {
+ caught ++;
+ }
+ catch (Exception ) {
+ Console.WriteLine("Didn't catch specific exception.");
+ iExitCode = 3;
+ try{
+ Console.WriteLine("Something new");
+ }
+ catch(DivideByZeroException ){
+ }
+ finally{
+ Console.WriteLine("Is this ever reached?");
+ }
+
+ }
+ finally {
+ int [] i = new int[10];
+ try{
+ throw new NullReferenceException();
+// Console.WriteLine("Exception Not Thrown in Finally");
+ }
+ catch(NullReferenceException e){
+ Console.WriteLine(e.StackTrace);
+ caught++;
+ }
+ catch(Exception ){
+ Console.WriteLine("Correct Exception not caught");
+ }
+ finally
+ {
+ GC.Collect();
+ fincount++;
+ }
+
+ fincount ++;
+ }
+ }
+ catch (Exception ) {
+ Console.WriteLine("Didn't catch specific exception.");
+ iExitCode = 3;
+ }
+ finally {
+ GC.Collect();
+ fincount ++;
+ }
+
+ try {
+ try {
+ throw new NullReferenceException();
+// Console.WriteLine("Exception not thrown.");
+// iExitCode = 1;
+ }
+ catch (NullReferenceException ) {
+ caught ++;
+ throw new OutOfMemoryException();
+// Console.WriteLine("Exception not thrown.");
+// iExitCode = 1;
+ }
+ catch (Exception ) {
+ Console.WriteLine("Didn't catch specific exception.");
+ iExitCode = 3;
+ }
+ finally {
+ GC.Collect();
+ fincount ++;
+ }
+ }
+ catch (OutOfMemoryException ) {
+ caught ++;
+ }
+ finally {
+ GC.Collect();
+ fincount ++;
+ }
+
+ if (caught != 5) {
+ Console.WriteLine("Didn't catch enough exceptions.");
+ iExitCode = 4;
+ }
+ if (fincount != 5) {
+ Console.WriteLine("Didn't execute enough finallys.");
+ iExitCode = 5;
+ }
+ }
+
+ public static int Main(String[] args)
+ {
+ int retVal = 100;
+ String str = "Done";
+ (new TestClass()).TestMain();
+ if (iExitCode == 0) {
+ Console.WriteLine("Test Passed.");
+ } else {
+ Console.WriteLine("Test FAILED.");
+ retVal = iExitCode;
+ }
+ Console.WriteLine(str);
+ return retVal;
+}
+
+};
+
+
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx2.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx2.csproj
new file mode 100644
index 0000000000..f5b6b4f10f
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedEx2.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="NestedEx2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedException.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedException.cs
new file mode 100644
index 0000000000..c9f04d4d6e
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedException.cs
@@ -0,0 +1,114 @@
+// 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.Threading;
+
+class UserException1 : Exception {
+ public int ExceptionId;
+
+ public UserException1(int id){
+ ExceptionId = id;
+ }
+}
+
+class UserException2 : Exception {
+ public int ExceptionId;
+
+ public UserException2(int id){
+ ExceptionId = id;
+ }
+}
+
+class UserException3 : Exception {
+ public int ExceptionId;
+
+ public UserException3(int id){
+ ExceptionId = id;
+ }
+}
+
+class UserException4 : Exception {
+ public int ExceptionId;
+
+ public UserException4(int id){
+ ExceptionId = id;
+ }
+}
+
+
+public class NestedException {
+ private int ThreadId;
+
+ public NestedException(int id){
+ ThreadId = id;
+ }
+
+
+ public static int Main(String []args) {
+ String s = "Done";
+ int retVal = 100;
+ Thread mv_Thread;
+ NestedException [] ne = new NestedException[10];
+ for (int i = 0 ; i < 10; i++){
+ ne[i] = new NestedException(i);
+ mv_Thread = new Thread(new ThreadStart(ne[i].runtest));
+ try {
+ mv_Thread.Start();
+ }
+ catch (Exception ){
+ retVal = 0;
+ Console.WriteLine("Exception was caught in main");
+ }
+ }
+ Console.WriteLine(s);
+ return retVal;
+ }
+
+ public void runtest(){
+ try {
+ try {
+ try {
+ try {
+ switch (ThreadId){
+ case 0: throw new UserException1(ThreadId);
+ case 1: throw new UserException2(ThreadId);
+ case 2: throw new UserException3(ThreadId);
+ case 3: throw new UserException4(ThreadId);
+ default:
+ throw new Exception();
+ }
+
+ }
+ catch (UserException1 e){
+ lock(this){
+ Console.WriteLine("The Exception1 " + e.ExceptionId + " was caught");
+ }
+ }
+ }
+ catch (UserException2 e) {
+ lock(this){
+ Console.WriteLine("The Exception2 " + e.ExceptionId + " was caught");
+ }
+ }
+ }
+ catch (UserException3 e){
+ lock(this){
+ Console.WriteLine("The Exception3 " + e.ExceptionId + " was caught");
+ }
+ }
+ }
+ catch (UserException4 e) {
+ lock(this){
+ Console.WriteLine("The Exception4 " + e.ExceptionId + " was caught");
+ }
+ }
+ catch (Exception ){
+ lock(this){
+ Console.WriteLine("Exception was caught");
+ }
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedException.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedException.csproj
new file mode 100644
index 0000000000..0f4693fcc2
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NestedException.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="NestedException.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NormalException.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NormalException.cs
new file mode 100644
index 0000000000..3ed4a87503
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NormalException.cs
@@ -0,0 +1,202 @@
+// 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;
+
+class UserException : Exception{
+
+ public UserException(){
+ throw new ArithmeticException();
+ }
+}
+
+class ComplexByte {
+
+ byte real = 0 ;
+ byte imag = 0 ;
+
+ byte getrealpart( )
+ {
+ return real;
+ }
+
+ byte getimagpart( )
+ {
+ return imag;
+ }
+
+ int equals( int realparam, int imagparam )
+ {
+ if (real != realparam)
+ {
+ return 0;
+ }
+ if (imag != imagparam)
+ {
+ return 0;
+ }
+ return 1;
+ }
+
+ int equals( ComplexByte cparm )
+ {
+ if (real != cparm.getrealpart())
+ {
+ return 0;
+ }
+ if(imag != cparm.getimagpart( ))
+ {
+ return 0;
+ }
+ return 1;
+ }
+
+
+ void assign( int realparm, int imagparm )
+ {
+ if( ( realparm > 127 ) || ( realparm < -128 ) )
+ throw new ArgumentException();
+ if( ( imagparm > 127 ) || ( imagparm < -128 ) )
+ throw new ArgumentException();
+ real = (byte) realparm;
+ imag = (byte) imagparm;
+ }
+
+ void assign( ComplexByte cparm )
+ {
+ real = cparm.getrealpart( );
+ imag = cparm.getimagpart( );
+ }
+
+ public void add( int realparm, int imagparm )
+ {
+ int rtemp, itemp;
+
+ rtemp = real + realparm;
+ if ( ( rtemp > 127 ) || ( rtemp < -128 ) )
+ throw new ArithmeticException();
+ itemp = imag + imagparm;
+ if ( ( itemp > 127 ) || ( itemp < -128 ) )
+ throw new ArithmeticException();
+ real = (byte)(rtemp);
+ imag = (byte)(itemp);
+ }
+
+ void add( ComplexByte cparm )
+ {
+ int rtemp, itemp;
+ rtemp = real + cparm.getrealpart();
+ if ( ( rtemp > 127 ) || ( rtemp < -128 ) )
+ throw new ArithmeticException();
+ itemp = imag + cparm.getimagpart();
+ if ( ( itemp > 127 ) || ( itemp < -128 ) )
+ throw new ArithmeticException();
+ real = (byte)( rtemp);
+ imag = (byte)( itemp );
+ }
+
+
+ void multiply( int realparm, int imagparm )
+ {
+ int rtemp, itemp;
+
+ rtemp = ( real * realparm - imag * imagparm );
+ itemp = (real * imagparm + realparm * imag );
+ if ( ( rtemp > 127 ) || ( rtemp < -128 ) )
+ throw new ArithmeticException();
+ if ( ( itemp > 127 ) || ( itemp < -128 ) )
+ throw new ArithmeticException();
+ real = (byte) rtemp;
+ imag = (byte) itemp;
+ }
+
+ void multiply( ComplexByte cparm )
+ {
+ int rtemp, itemp;
+
+ rtemp = (real * cparm.getrealpart( ) - imag * cparm.getimagpart( ));
+ itemp = (real * cparm.getimagpart( ) + cparm.getrealpart( ) * imag);
+
+ if ( ( rtemp > 127 ) || ( rtemp < -128 ) )
+ throw new ArithmeticException();
+ if ( ( itemp > 127 ) || ( itemp < -128 ) )
+ throw new ArithmeticException();
+ real = (byte) rtemp;
+ imag = (byte) itemp;
+ }
+
+ public ComplexByte( )
+ {
+ this.real = 0 ;
+ this.imag = 0 ;
+ }
+
+ public ComplexByte( int realparm, int imagparm )
+ {
+ if ( ( realparm > 127 ) || ( realparm < -128 ) )
+ throw new ArgumentException();
+ if ( ( imagparm > 127 ) || ( imagparm < -128 ) )
+ throw new ArgumentException();
+ real = (byte) realparm;
+ imag = (byte) imagparm;
+ }
+
+ public ComplexByte( ComplexByte cparm )
+ {
+ this.real = cparm.getrealpart( );
+ this.imag = cparm.getimagpart( );
+ }
+
+}
+
+public class NormalException {
+
+ public static int Main( String [] args )
+ {
+ String s = "Done";
+ int retVal = 100;
+ int tryflag = 1;
+
+ try {
+ throw new UserException();
+ }
+ catch (ArithmeticException ){
+ Console.WriteLine("AE was caught");
+
+ }
+
+ try {
+ ComplexByte c4 = new ComplexByte( 200, -200 );
+ }
+ catch ( ArgumentException ) {
+ tryflag = 0; // we caught it
+ Console.WriteLine( "Caught Argument Exception in Test Case 8" );
+ }
+ finally {
+ if ( tryflag != 0 ) {
+ retVal = 8;
+ }
+ }
+
+ tryflag = 1;
+
+ try {
+ ComplexByte c4 = new ComplexByte( 100, -100 );
+ c4.add( 200, -200 );
+ }
+ catch ( ArithmeticException ) {
+ tryflag = 0; // we caught it
+ Console.WriteLine( "Caught Arithmetic Exception in Test Case 9" );
+ }
+ finally {
+ if ( tryflag != 0 ) {
+ retVal = 9;
+ }
+ }
+
+
+ Console.WriteLine(s);
+ return retVal;
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NormalException.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NormalException.csproj
new file mode 100644
index 0000000000..f51b9220f4
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/NormalException.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="NormalException.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/RecursiveException.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/RecursiveException.cs
new file mode 100644
index 0000000000..052a48868a
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/RecursiveException.cs
@@ -0,0 +1,50 @@
+// 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.Threading;
+using System.IO;
+
+class UserException : Exception {
+
+}
+
+public class RecursiveException {
+ public static int Main(String [] args) {
+ String s = "Done";
+ int retVal = 100;
+ Thread mv_Thread;
+ RecursiveException re = new RecursiveException();
+ for (int i = 0 ; i < 10; i++){
+ mv_Thread = new Thread(new ThreadStart(re.runtest));
+ try {
+ mv_Thread.Start();
+ }
+ catch (Exception ){
+ Console.WriteLine("Exception was caught in main");
+ retVal = 0;
+ }
+ }
+ Console.WriteLine(s);
+ return retVal;
+ }
+
+ public void runtest(){
+ try {
+ recurse(0);
+ }
+ catch (UserException ) {
+ lock(this)
+ {
+ Console.WriteLine("The Exception was caught");
+ }
+ }
+ }
+
+ public void recurse(int counter) {
+ if (counter == 1000)
+ throw new UserException();
+ else
+ recurse(++counter);
+ }
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/RecursiveException.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/RecursiveException.csproj
new file mode 100644
index 0000000000..2926c27f10
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/RecursiveException.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="RecursiveException.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatch.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatch.cs
new file mode 100644
index 0000000000..3642b9984c
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatch.cs
@@ -0,0 +1,107 @@
+// 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;
+
+
+public class TryCatch{
+ public static int Main(String [] args) {
+ int retVal = 100;
+ int i = 0;
+ String m_str = "";
+ String str = "Done";
+
+ try {
+ throw new ArithmeticException();
+ }
+ catch ( ArithmeticException ) {
+ m_str = m_str + "ArithmeticException\n";
+ i++;
+ }
+
+ try {
+ throw new DivideByZeroException();
+ }
+ catch ( DivideByZeroException ) {
+ m_str = m_str + "DivideByZeroException\n";
+ i++;
+ }
+
+ try {
+ throw new OverflowException();
+ }
+ catch ( OverflowException ) {
+ m_str = m_str + "OverflowException\n";
+ i++;
+ }
+
+ try {
+ throw new ArgumentException();
+ }
+ catch ( ArgumentException ) {
+ m_str = m_str + "ArgumentException\n";
+ i++;
+ }
+
+ try {
+ throw new ArrayTypeMismatchException();
+ }
+ catch ( ArrayTypeMismatchException ) {
+ m_str = m_str + "ArrayTypeMismatchException\n";
+ i++;
+ }
+
+ try {
+ throw new MemberAccessException();
+ }
+ catch ( MemberAccessException ) {
+ m_str = m_str + "AccessException\n";
+ i++;
+ }
+
+ try {
+ throw new FieldAccessException();
+ }
+ catch ( FieldAccessException ) {
+ m_str = m_str + "FieldAccessException\n";
+ i++;
+ }
+
+ try {
+ throw new MissingFieldException();
+ }
+ catch ( MissingFieldException ) {
+ m_str = m_str + "MissingFieldException\n";
+ i++;
+ }
+
+ try {
+ throw new MethodAccessException();
+ }
+ catch ( MethodAccessException ) {
+ m_str = m_str + "MethodAccessException\n";
+ i++;
+ }
+
+ try {
+ throw new MissingMethodException();
+ }
+ catch ( MissingMethodException ) {
+ m_str = m_str + "MissingMethodException\n";
+ i++;
+ }
+
+ Console.WriteLine( m_str );
+ if (i == 10){
+ Console.WriteLine("Test Passed");
+ }
+ else {
+ Console.WriteLine("Test Failed");
+ retVal = 1;
+ }
+ Console.WriteLine(str);
+ return retVal;
+
+ }
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatch.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatch.csproj
new file mode 100644
index 0000000000..28d4c7f6dd
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatch.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="TryCatch.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatchFinally.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatchFinally.cs
new file mode 100644
index 0000000000..bc25b16814
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatchFinally.cs
@@ -0,0 +1,31 @@
+// 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;
+
+
+public class TryCatchFinally{
+ public static int Main(String [] args) {
+ int i = 1;
+ String m_str = "Failed";
+ String str = "Done";
+
+ try {
+ throw new ArithmeticException();
+ }
+ catch ( ArithmeticException ) {
+ m_str = "Passed Catch";
+ i = 1;
+ }
+ finally {
+ m_str = m_str + " and Passed Finally";
+ i = 100;
+ }
+
+ Console.WriteLine( "TryCatch Test " + m_str );
+ Console.WriteLine(str);
+ return i;
+
+ }
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatchFinally.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatchFinally.csproj
new file mode 100644
index 0000000000..a785878dd3
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/TryCatchFinally.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="TryCatchFinally.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/Unmanaged.cpp b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/Unmanaged.cpp
new file mode 100644
index 0000000000..8f5b97cbad
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/Unmanaged.cpp
@@ -0,0 +1,26 @@
+// 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.
+
+#include "Unmanaged.h"
+
+BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
+{
+ /* No Need to do anything here -- for now */
+ return TRUE;
+}
+
+
+EXPORT VOID UnmanagedCode( int iGiven )
+{
+ int i;
+
+ printf("[unmanaged code] software divide by zero:\n");
+ RaiseException( EXCEPTION_INT_DIVIDE_BY_ZERO, 0, 0, 0);
+
+
+ printf("[unmanaged code] hardware divide by zero:\n");
+ i = 5 / iGiven;
+
+ printf("[unmanaged code] ... and survived? %i\n",i);
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/Unmanaged.h b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/Unmanaged.h
new file mode 100644
index 0000000000..b1f6eb6a73
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/Unmanaged.h
@@ -0,0 +1,9 @@
+// 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.
+
+#include <stdio.h>
+#include <windows.h>
+
+#define EXPORT extern "C" __declspec(dllexport)
+
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UnmanagedToManaged.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UnmanagedToManaged.cs
new file mode 100644
index 0000000000..d5f9222328
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UnmanagedToManaged.cs
@@ -0,0 +1,34 @@
+// 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.Runtime.InteropServices;
+
+public class UnmanagedToManaged {
+
+ ///** @dll.import("Unmanaged.dll")*/
+ [System.Runtime.InteropServices.DllImport("unmanaged.dll")]
+ public static extern void UnmanagedCode( int i) ;
+
+ public static int Main(String []args){
+ String s = "Done";
+ int retVal = 0;
+ try {
+ Console.WriteLine("Calling unmanaged code...");
+ UnmanagedCode(0);
+ Console.WriteLine("...Returned from unmanaged code");
+ }
+ catch (DivideByZeroException )
+ {
+ Console.WriteLine("Caught a div-by-zero exception.");
+ retVal = 100;
+ }
+ catch (Exception )
+ {
+ Console.WriteLine("Caught a general exception");
+ }
+ Console.WriteLine(s);
+ return retVal;
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UnmanagedToManaged.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UnmanagedToManaged.csproj
new file mode 100644
index 0000000000..c5346713a2
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UnmanagedToManaged.csproj
@@ -0,0 +1,47 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="UnmanagedToManaged.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="CMakeLists.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserException.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserException.cs
new file mode 100644
index 0000000000..b8aa396609
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserException.cs
@@ -0,0 +1,42 @@
+// 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.Threading;
+
+public class UserException : Exception {
+ public static int Main(String [] args) {
+ int counter = 0;
+ String str = "Done";
+
+ for (int j = 0; j < 100; j++){
+ try {
+ if (j % 2 == 0)
+ counter = j / (j % 2);
+ else
+ throw new UserException();
+ }
+ catch ( UserException ) {
+ counter++;
+ continue;
+ }
+ catch (ArithmeticException ){
+ counter--;
+ continue;
+ }
+ catch (Exception ){}
+ finally {
+ counter++;
+ }
+ }
+ if (counter == 100){
+ Console.WriteLine( "TryCatch Test Passed" );
+ return 100;
+ }
+ else{
+ Console.WriteLine( "TryCatch Test Failed" );
+ return 1;
+ }
+ Console.WriteLine(str);
+ }
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserException.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserException.csproj
new file mode 100644
index 0000000000..c5bbae0c9c
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserException.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="UserException.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserExceptionThread.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserExceptionThread.cs
new file mode 100644
index 0000000000..020f80b375
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserExceptionThread.cs
@@ -0,0 +1,59 @@
+// 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.Threading;
+using System.IO;
+
+public class UserExceptionThread : Exception {
+ static int retVal = 100;
+
+ public static int Main(String []args) {
+ Thread mv_Thread;
+ String str = "Done";
+ UserExceptionThread ue = new UserExceptionThread();
+ for (int i = 0 ; i < 10; i++){
+ mv_Thread = new Thread(new ThreadStart(ue.runtest));
+ try {
+ mv_Thread.Start();
+ }
+ catch (Exception ){
+ Console.WriteLine("Exception was caught in main");
+ }
+ }
+ Console.WriteLine(str);
+ return retVal;
+ }
+
+ public void runtest(){
+ int counter = 0;
+ for (int j = 0; j < 100; j++){
+ try {
+ if (j % 2 == 0)
+ counter = j / (j % 2);
+ else
+ throw new UserExceptionThread();
+ }
+ catch ( UserExceptionThread ) {
+ counter++;
+ continue;
+ }
+ catch (ArithmeticException ){
+ counter--;
+ continue;
+ }
+ finally {
+ counter++;
+ }
+ }
+ if (counter == 100){
+ lock(this){
+ Console.WriteLine( "TryCatch Test Passed" );
+ }
+ }
+ else{
+ Console.WriteLine( "TryCatch Test Failed" );
+ retVal = 1;
+ }
+ }
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserExceptionThread.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserExceptionThread.csproj
new file mode 100644
index 0000000000..a49b9acc02
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/VJ/UserExceptionThread.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="UserExceptionThread.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Except.il b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Except.il
new file mode 100644
index 0000000000..1e481a350d
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Except.il
@@ -0,0 +1,99 @@
+// 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.
+//
+// Except.asm
+// Revised 4.01.99 by t-joecl
+// Revised 7.01.99 by manishg
+// Basic exception handling test case.
+//
+.assembly extern legacy library mscorlib{}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+
+.assembly Except.exe{
+ //This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration:
+ //[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )]
+ .permission reqmin ['mscorlib']System.Security.Permissions.SecurityPermissionAttribute ( "SkipVerification" = true )
+}
+
+.class Except {
+
+// global for storing return value - defaults to 0 for success
+
+
+// .data iResult = int32(0x00000000)
+.field static int32 iResult
+
+// Execution starts here
+
+.method static int32 main(class [mscorlib]System.String[]) {
+.locals (string)
+.entrypoint
+.maxstack 2
+
+ ldstr "Done"
+ stloc.0
+
+try_start:
+ ldc.i4 0xFFFFFF80
+ ldc.i4 0x0
+ div
+ pop
+ leave ENDOFTEST
+try_end:
+ // Error case 4 - exception _not thrown
+ ldstr "Error case 4 - exception _not thrown"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+
+ ldc.i4 0x4
+ stsfld int32 Except::iResult
+ br ENDOFTEST
+ //leave ENDOFTEST
+handler1:
+ isinst [mscorlib]System.ArithmeticException
+ brfalse error_case1
+ leave ENDOFTEST
+error_case1:
+ // Error case 1 - aHandler failure: trapped the wrong exception
+ ldstr "Error case 1 - aHandler failure: trapped the wrong exception"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x1
+ stsfld int32 Except::iResult
+ leave ENDOFTEST
+end_handler1:
+
+
+.try try_start to try_end catch [mscorlib]System.ArithmeticException handler handler1 to end_handler1
+
+ENDOFTEST:
+ ldsfld int32 Except::iResult
+ ldc.i4 0
+ ceq
+ brfalse RETFAIL
+ ldstr "Test succeeded (returning 100)."
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x64
+ br RETEND
+RETFAIL:
+ ldstr "Test FAILED."
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldsfld int32 Except::iResult
+RETEND:
+ ldloc.0
+ call void [System.Console]System.Console::WriteLine(string)
+ ret
+
+}
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Except.ilproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Except.ilproj
new file mode 100644
index 0000000000..80c2e088a6
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Except.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="Except.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltCatch.il b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltCatch.il
new file mode 100644
index 0000000000..f248a93fb7
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltCatch.il
@@ -0,0 +1,109 @@
+// 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.
+
+//
+// FiltCatch.asm
+// Revised 4.01.99 by t-joecl
+//
+// Apply filters that do trap an exception; make sure it doesn't get out
+// to an outer .exception aHandler.
+//
+.assembly extern legacy library mscorlib{}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+
+.assembly FiltCatch.exe{
+ //This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration:
+ //[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )]
+ .permission reqmin ['mscorlib']System.Security.Permissions.SecurityPermissionAttribute ( "SkipVerification" = true )}
+
+.class FiltCatch {
+
+// global for storing return value - defaults to 0 for success
+
+
+// .data iResult = int32(0x00000000)
+.field static int32 iResult
+
+// Execution starts here
+
+.method static int32 main(class [mscorlib]System.String[]) {
+.locals(string)
+.entrypoint
+.maxstack 2
+
+ ldstr "Done"
+ stloc.0
+
+.try{
+ newobj instance void [mscorlib]System.ArithmeticException::.ctor()
+ throw
+try_end:
+ // Error case 4 - exception _not thrown
+ ldstr "Error case 4 - exception _not thrown"
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x4
+ stsfld int32 FiltCatch::iResult
+ //br ENDOFTEST
+ leave ENDOFTEST
+}
+
+// aFilter one exception that won't be encountered;
+// let it fall through.
+
+filter{
+ isinst [mscorlib]System.OutOfMemoryException
+ brfalse OOMcontinue
+
+ // Error case 2 - aFilter failure: filtered the wrong exception
+ ldstr "Error case 2 - aFilter failure: filtered the wrong exception"
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x2
+ stsfld int32 FiltCatch::iResult
+ ldnull
+ br OOMendfilter
+OOMcontinue:
+ ldnull
+OOMendfilter:
+AEfilter:
+ isinst [mscorlib]System.ArithmeticException
+ brfalse AEcontinue
+ ldc.i4 0x00000001
+ br AEendfilter
+AEcontinue:
+ ldc.i4 0x00000001
+ br AEendfilter
+AEendfilter:
+ endfilter
+}
+{
+ pop
+ leave ENDOFTEST
+ENDOOMFILThandler:
+}
+
+ENDOFTEST:
+ ldsfld int32 FiltCatch::iResult
+ ldc.i4 0
+ ceq
+ brfalse RETFAIL
+ ldstr "Test succeeded (returning 100)."
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x64
+ br RETEND
+RETFAIL:
+ ldstr "Test FAILED."
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldsfld int32 FiltCatch::iResult
+RETEND:
+ ldloc.0
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ret
+
+}
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltCatch.ilproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltCatch.ilproj
new file mode 100644
index 0000000000..a0a5b26d49
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltCatch.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="FiltCatch.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltFallThru.il b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltFallThru.il
new file mode 100644
index 0000000000..4168fcd40b
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltFallThru.il
@@ -0,0 +1,170 @@
+// 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.
+
+//
+// FiltFallThru.asm
+// Revised 4.01.99 by t-joecl
+//
+// Apply filters that don't trap an exception, then catch it in an
+// outer .exception aHandler.
+//
+.assembly extern legacy library mscorlib{}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+
+.assembly FiltFallThru{
+//This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration:
+ //[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )]
+ .permission reqmin ['mscorlib']System.Security.Permissions.SecurityPermissionAttribute ( "SkipVerification" = true )}
+
+.class FiltFallThru {
+
+// global for storing return value - defaults to 0 for success
+
+
+// .data iResult = int32(0x00000000)
+.field static int32 iResult
+
+// Execution starts here
+
+.method static int32 main(class [mscorlib]System.String[]) {
+.locals(string)
+.entrypoint
+.maxstack 2
+
+ ldstr "Done"
+ stloc.0
+.try{
+ .try{
+ try_start:
+ newobj instance void [mscorlib]System.Security.SecurityException::.ctor()
+ throw
+ try_end:
+ // Error case 4 - exception _not thrown
+ ldstr "Error case 4 - exception _not thrown"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x4
+ stsfld int32 FiltFallThru::iResult
+ leave ENDOFTEST
+ }
+
+ // aFilter two exceptions that won't be encountered;
+ // let them fall through.
+ filter{
+ OOMfilter:
+ isinst [mscorlib]System.OutOfMemoryException
+ leave OOMcontinue
+
+ // Error case 2 - aFilter failure: filtered the wrong exception
+ ldstr "Error case 2 - aFilter failure: filtered the wrong exception"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x2
+ stsfld int32 FiltFallThru::iResult
+ ldnull
+ leave OOMendfilter
+ OOMcontinue:
+ ldnull
+ OOMendfilter:
+
+ AEfilter:
+ isinst [mscorlib]System.ArithmeticException
+ leave AEcontinue
+
+ // Error case 2 - aFilter failure: filtered the wrong exception
+ ldstr "Error case 2 - aFilter failure: filtered the wrong exception"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x2
+ stsfld int32 FiltFallThru::iResult
+ ldc.i4 0x00000001
+ leave AEendfilter
+ AEcontinue:
+ ldc.i4 0x00000000
+ AEendfilter:
+ endfilter
+ }
+ {
+ FILThandler:
+ pop
+ // isinst System.ArithmeticException
+ // brfalse FILTcontinue
+ // br FILTcontinue
+ FILTcontinue:
+ // Error case 3 - running aHandler for the wrong aFilter
+ ldstr "Error case 3 - running aHandler for the wrong aFilter"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x3
+ stsfld int32 FiltFallThru::iResult
+ leave ENDFILThandler
+ ENDFILThandler:
+ leave ENDOFTEST
+
+ FILThandler1:
+ pop
+ // isinst System.ArithmeticException
+ // brfalse FILTcontinue1
+ // br FILTcontinue1
+ FILTcontinue1:
+ // Error case 3 - running aHandler for the wrong aFilter
+ ldstr "Error case 3 - running aHandler for the wrong aFilter"
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x3
+ stsfld int32 FiltFallThru::iResult
+ leave ENDFILThandler1
+ ENDFILThandler1:
+ leave ENDOFTEST
+ }
+}
+
+catch [mscorlib]System.Security.SecurityException{
+SEChandler:
+ isinst [mscorlib]System.Security.SecurityException
+ brfalse handler_fail
+ br end_handler
+
+handler_fail:
+ // Error case 1 - aHandler failure: trapped the wrong exception
+ ldc.i4 0x1
+ stsfld int32 FiltFallThru::iResult
+ ldstr "Error case 1 - aHandler failure: trapped the wrong exception"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+end_handler:
+ leave ENDOFTEST
+}
+ENDOFTEST:
+ ldsfld int32 FiltFallThru::iResult
+ ldc.i4 0
+ ceq
+ brfalse RETFAIL
+ ldstr "Test succeeded (returning 100)."
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x64
+ br RETEND
+RETFAIL:
+ ldstr "Test FAILED."
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldsfld int32 FiltFallThru::iResult
+RETEND:
+ ldloc.0
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ret
+
+}
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltFallThru.ilproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltFallThru.ilproj
new file mode 100644
index 0000000000..576d6e6b71
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltFallThru.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="FiltFallThru.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Filter.il b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Filter.il
new file mode 100644
index 0000000000..6f98b9e53b
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Filter.il
@@ -0,0 +1,102 @@
+// 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.
+//
+// Filter.asm
+// Revised 4.01.99 by t-joecl
+//
+// Basic aFilter test case.
+//
+.assembly extern legacy library mscorlib{}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+
+.assembly Filter.exe{}
+
+
+.class Filter {
+
+// global for storing return value - defaults to 0 for success
+
+
+// .data iResult = int32(0x00000000)
+.field static int32 iResult
+
+// Execution starts here
+
+.method static int32 main(class [mscorlib]System.String[]) {
+.locals(string)
+.entrypoint
+.maxstack 2
+
+ ldstr "Done"
+ stloc.0
+
+.try{
+try_start:
+ newobj instance void [mscorlib]System.Security.SecurityException::.ctor()
+ throw
+try_end:
+ // Error case 4 - exception _not thrown
+ ldstr "Error case 4 - exception _not thrown"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x4
+ stsfld int32 Filter::iResult
+ leave ENDOFTEST
+}
+filter{
+filter1:
+ isinst [mscorlib]System.Security.SecurityException
+ brfalse continue1
+ ldc.i4 0x00000001
+ br endfilter1
+continue1:
+ ldc.i4 0x00000000
+endfilter1:
+ endfilter
+}
+{
+handler1:
+ isinst [mscorlib]System.Security.SecurityException
+ brfalse handler_fail1
+ br end_handler1
+handler_fail1:
+ // Error case 3 - running aHandler for the wrong aFilter
+ ldstr "Error case 3 - running aHandler for the wrong aFilter"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x1
+ stsfld int32 Filter::iResult
+end_handler1:
+ leave ENDOFTEST
+}
+ENDOFTEST:
+ ldsfld int32 Filter::iResult
+ ldc.i4 0
+ ceq
+ brfalse RETFAIL
+ ldstr "Test succeeded (returning 100)."
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x64
+ br RETEND
+RETFAIL:
+ ldstr "Test FAILED."
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldsfld int32 Filter::iResult
+RETEND:
+ ldloc.0
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ret
+
+}
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Filter.ilproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Filter.ilproj
new file mode 100644
index 0000000000..6abe96b182
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Filter.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="filter.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Finally.il b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Finally.il
new file mode 100644
index 0000000000..06d1338a8c
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Finally.il
@@ -0,0 +1,127 @@
+// 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.
+//
+// Finally.asm
+// Revised 4.01.99 by t-joecl
+//
+// Exercises finally exception syntax.
+//
+.assembly extern legacy library mscorlib{}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+
+.assembly Finally.exe{
+//This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration:
+ //[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )]
+ .permission reqmin ['mscorlib']System.Security.Permissions.SecurityPermissionAttribute ( "SkipVerification" = true )}
+
+
+.class Finally {
+.field static int32 iResult
+.field static int32 finally_flag
+
+// global for storing return value - defaults to 0 for success
+//iResult:
+// i4 0x00000000
+//finally_flag:
+// i4 0x00000000
+
+//clinit
+.method static void .cctor() {
+.maxstack 1
+ ldc.i4 0
+ stsfld int32 Finally::iResult
+ ldc.i4 0
+ stsfld int32 Finally::finally_flag
+ ret
+}
+
+// Execution starts here
+
+.method static int32 main(class [mscorlib]System.String[]) {
+.locals(string)
+.entrypoint
+.maxstack 2
+
+ ldstr "Done"
+ stloc.0
+
+try_start:
+ newobj instance void [mscorlib]System.ArithmeticException::.ctor()
+ throw
+try_end:
+ // Error case 4 - exception _not thrown
+ ldstr "Error case 4 - exception _not thrown"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x4
+ stsfld int32 Finally::iResult
+ leave ENDOFTEST
+
+handler1:
+ isinst [mscorlib]System.ArithmeticException
+ brfalse handler_continue1
+ leave end_handler1
+handler_continue1:
+ // Error case 1 - aHandler failure: trapped the wrong exception
+ ldstr "Error case 1 - aHandler failure: trapped the wrong exception"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x1
+ stsfld int32 Finally::iResult
+end_handler1:
+ leave ENDOFhandler1
+ENDOFhandler1:
+ leave ENDOFTEST
+
+finally1:
+ ldstr "Successfully called the finally block."
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x1
+ stsfld int32 Finally::finally_flag
+ endfinally
+ENDOFFinally:
+
+.try try_start to try_end catch [mscorlib]System.ArithmeticException handler handler1 to ENDOFhandler1
+.try try_start to finally1 finally handler finally1 to ENDOFFinally
+
+ENDOFTEST:
+ ldsfld int32 Finally::finally_flag
+ ldc.i4 1
+ ceq
+ brfalse FINALLYFAIL
+
+ ldsfld int32 Finally::iResult
+ ldc.i4 0
+ ceq
+ brfalse RETFAIL
+ ldstr "Test succeeded (returning 100)."
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x64
+ br RETEND
+FINALLYFAIL:
+ ldstr "Error case 2 - finally _not called"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+RETFAIL:
+ ldstr "Test FAILED."
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldsfld int32 Finally::iResult
+RETEND:
+ ldloc.0
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ret
+
+}
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Finally.ilproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Finally.ilproj
new file mode 100644
index 0000000000..f1ba3e7e27
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/Finally.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="Finally.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedExcept.il b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedExcept.il
new file mode 100644
index 0000000000..e6197fd7a1
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedExcept.il
@@ -0,0 +1,108 @@
+// 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.
+
+//
+// NestedExcept.asm
+// Revised 4.01.99 by t-joecl
+//
+// Nested exception test cases.
+//
+.assembly extern legacy library mscorlib{}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+
+.assembly NestedExcept.exe{}
+
+.class NestedExcept {
+
+// global for storing return value - defaults to 0 for success
+
+
+// .data iResult = int32(0x00000000)
+.field static int32 iResult
+
+// Execution starts here
+
+.method static int32 main(class [mscorlib]System.String[]) {
+.locals(string)
+.entrypoint
+.maxstack 2
+
+ ldstr "Done"
+ stloc.0
+
+try_start:
+ newobj instance void [mscorlib]System.Security.SecurityException::.ctor()
+ throw
+try_end:
+ // Error case 4 - exception _not thrown
+ ldstr "Error case 4 - exception _not thrown"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x4
+ stsfld int32 NestedExcept::iResult
+ br ENDOFTEST
+
+handler1:
+ isinst [mscorlib]System.Security.SecurityException
+ brfalse error_case1
+// br end_handler1
+ leave ENDOFhandler1
+error_case1:
+ // Error case 1 - aHandler failure: trapped the wrong exception
+ ldstr "Error case 1 - aHandler failure: trapped the wrong exception"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x1
+ stsfld int32 NestedExcept::iResult
+end_handler1:
+ leave ENDOFhandler1
+ENDOFhandler1:
+ br after_handler2
+
+handler2:
+ pop
+ // Error case 5 - exception propagates beyond first aHandler
+ ldstr "Error case 5 - exception propagates beyond first aHandler"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x5
+ stsfld int32 NestedExcept::iResult
+ leave after_handler2
+
+after_handler2:
+
+.try try_start to try_end catch [mscorlib]System.Security.SecurityException handler handler1 to ENDOFhandler1
+.try try_start to try_end catch [mscorlib]System.Security.SecurityException handler handler2 to after_handler2
+
+ENDOFTEST:
+ ldsfld int32 NestedExcept::iResult
+ ldc.i4 0
+ ceq
+ brfalse RETFAIL
+ ldstr "Test succeeded (returning 100)."
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x64
+ br RETEND
+RETFAIL:
+ ldstr "Test FAILED."
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldsfld int32 NestedExcept::iResult
+RETEND:
+ ldloc.0
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ret
+
+}
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedExcept.ilproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedExcept.ilproj
new file mode 100644
index 0000000000..3c49c3bbe2
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedExcept.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="NestedExcept.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedFilt.il b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedFilt.il
new file mode 100644
index 0000000000..ca55a34e92
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedFilt.il
@@ -0,0 +1,151 @@
+// 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.
+//
+// NestedFilt.asm
+// Revised 4.01.99 by t-joecl
+//
+// Nests filters that catch the same exception.
+//
+.assembly extern legacy library mscorlib{}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+
+.assembly NestedFilt.exe{}
+
+.class NestedFilt {
+
+// global for storing return value - defaults to 0 for success
+
+
+// .data iResult = int32(0x00000000)
+.field static int32 iResult
+
+// Execution starts here
+
+.method static int32 main(class [mscorlib]System.String[]) {
+.locals(string)
+.entrypoint
+.maxstack 3
+
+ ldstr "Done"
+ stloc.0
+
+try_start:
+ newobj instance void [mscorlib]System.ArithmeticException::.ctor()
+ throw
+try_end:
+ // Error case 4 - exception _not thrown
+ ldstr "Error case 4 - exception _not thrown"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x4
+ stsfld int32 NestedFilt::iResult
+ br ENDOFTEST
+
+
+filter1:
+ isinst [mscorlib]System.ArithmeticException
+ brfalse continue1
+ ldc.i4 0x00000001
+ br endfilter1
+continue1:
+ ldc.i4 0x00000000
+ // Error case 2 - aFilter failure: filtered the wrong exception
+ ldstr "Error case 2 - aFilter failure: filtered the wrong exception"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x2
+ stsfld int32 NestedFilt::iResult
+endfilter1:
+ endfilter
+
+
+handler1:
+ isinst [mscorlib]System.ArithmeticException
+ brfalse handler_continue1
+ br end_handler1
+handler_continue1:
+ // Error case 1 - aHandler failure: trapped the wrong exception
+ ldstr "Error case 1 - aHandler failure: trapped the wrong exception"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x1
+ stsfld int32 NestedFilt::iResult
+end_handler1:
+ leave ENDOFhandler1
+ENDOFhandler1:
+ br after_handler2
+
+filter2:
+ isinst [mscorlib]System.ArithmeticException
+ brfalse continue2
+ ldc.i4 0x00000001
+ br endfilter2
+continue2:
+ ldc.i4 0x00000000
+ // Error case 2 - aFilter failure: filtered the wrong exception
+ ldstr "Error case 2 - aFilter failure: filtered the wrong exception"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x2
+ stsfld int32 NestedFilt::iResult
+endfilter2:
+ // Error case 5 - exception propagates beyond first aFilter
+ ldstr "Error case 5 - exception propagates beyond first aFilter"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x5
+ stsfld int32 NestedFilt::iResult
+ endfilter
+
+handler2:
+ pop
+ // Error case 5 - exception propagates beyond first aFilter
+ ldstr "Error case 5 - exception propagates beyond first aFilter"
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x5
+ stsfld int32 NestedFilt::iResult
+ leave ENDOFhandler2
+
+ENDOFhandler2:
+
+.try try_start to try_end filter filter1 handler handler1 to ENDOFhandler1
+.try try_start to try_end filter filter2 handler handler2 to ENDOFhandler2
+
+after_handler2:
+
+ENDOFTEST:
+ ldsfld int32 NestedFilt::iResult
+ ldc.i4 0
+ ceq
+ brfalse RETFAIL
+ ldstr "Test succeeded (returning 100)."
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4 0x64
+ br RETEND
+RETFAIL:
+ ldstr "Test FAILED."
+
+
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldsfld int32 NestedFilt::iResult
+RETEND:
+ ldloc.0
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ret
+
+}
+}
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedFilt.ilproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedFilt.ilproj
new file mode 100644
index 0000000000..4ad4bf0aed
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/NestedFilt.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="NestedFilt.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/coverage/Exceptions.cs b/tests/src/baseservices/exceptions/regressions/V1/SEH/coverage/Exceptions.cs
new file mode 100644
index 0000000000..b4418ecdf3
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/coverage/Exceptions.cs
@@ -0,0 +1,467 @@
+// 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.Resources;
+using System.Runtime.InteropServices;
+using System.Security;
+using System.Threading;
+
+class MightyExceptor
+{
+ static int Result = 100;
+
+ public static int Main(String[] Args)
+ {
+ try
+ {
+ Console.WriteLine("Throwing ArgumentException..");
+ throw new ArgumentException("Invalid Argument", "Paramzi", new Exception());
+ }
+ catch(ArgumentException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.ParamName);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing ArgumentOutOfRangeException..");
+ throw new ArgumentOutOfRangeException("Arguement Name", 1, "Arguement Shame");
+
+ }
+ catch(ArgumentOutOfRangeException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.ActualValue);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing BadImageFormatException..");
+ throw new BadImageFormatException("I'm bad, I'm bad..", "YouKnowMe.txt");
+
+ }
+ catch(BadImageFormatException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.FileName);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing another BadImageFormatException..");
+ throw new BadImageFormatException("This is a really bad image..", "BadFile.exe", new Exception());
+
+ }
+ catch(BadImageFormatException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.FileName);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing more BadImageFormatExceptions..");
+ throw new BadImageFormatException("Yup, it's bad alright", new Exception());
+
+ }
+ catch(BadImageFormatException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.FileName);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing DllNotFoundException..");
+ throw new DllNotFoundException("Where is my DLL?");
+
+ }
+ catch(DllNotFoundException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing another DllNotFoundException..");
+ throw new DllNotFoundException("The DLL is unavailable, please try again later.", new Exception());
+
+ }
+ catch(DllNotFoundException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing DirectoryNotFoundException..");
+ throw new DirectoryNotFoundException("You've been had, the folder is gone.", new Exception());
+
+ }
+ catch(DirectoryNotFoundException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing EndOfStreamException..");
+ throw new EndOfStreamException("The Stream is finished.", new Exception());
+
+ }
+ catch(EndOfStreamException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing FileLoadException..");
+ throw new FileLoadException("Zis is a mesage..", "File1.abc", new Exception());
+
+ }
+ catch(FileLoadException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.FileName);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing another FileLoadException..");
+ throw new FileLoadException("Nice try..");
+
+ }
+ catch(FileLoadException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.FileName);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing yet another FileLoadException..");
+ throw new FileLoadException("Keep trying..", new Exception());
+
+ }
+ catch(FileLoadException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.FileName);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing more FileLoadExceptions..");
+ throw new FileLoadException("Zis is a mesage..", "File1.abc");
+
+ }
+ catch(FileLoadException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.FileName);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing FileNotFoundException..");
+ throw new FileNotFoundException("What file are you talking about?", "Windows.exe", new Exception());
+
+ }
+ catch(FileNotFoundException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.FileName);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing another FileNotFoundException..");
+ throw new FileNotFoundException("Raiders of the lost file?", new Exception());
+
+ }
+ catch(FileNotFoundException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.FileName);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing PathTooLongException..");
+ throw new PathTooLongException("Slow down, boy!", new Exception());
+
+ }
+ catch(PathTooLongException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing InvalidProgramException..");
+ throw new InvalidProgramException("Le Programe est invaleed.", new Exception());
+
+ }
+ catch(InvalidProgramException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing another InvalidProgramException..");
+ throw new InvalidProgramException("This program is invalid, parental guidance is advised.");
+
+ }
+ catch(InvalidProgramException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing MissingFieldException..");
+ throw new MissingFieldException("Where's the field, kid?", new Exception());
+
+ }
+ catch(MissingFieldException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing MissingMemberException..");
+ throw new MissingMemberException("Classy");
+
+ }
+ catch(MissingMemberException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing NotImplementedException..");
+ throw new NotImplementedException("What are you talking about?", new Exception());
+
+ }
+ catch(NotImplementedException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing ObjectDisposedException..");
+ throw new ObjectDisposedException("Bad Object!");
+
+ }
+ catch(ObjectDisposedException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing another ObjectDisposedException..");
+ throw new ObjectDisposedException("");
+
+ }
+ catch(ObjectDisposedException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing AmbiguousMatchException..");
+ throw new AmbiguousMatchException("Humpty Dumpty sat on a wall..", new Exception());
+
+ }
+ catch(AmbiguousMatchException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing ReflectionTypeLoadException..");
+ Type[] Typo = new Type[1];
+ Exception[] Excepto = new Exception[1];
+ throw new ReflectionTypeLoadException(Typo, Excepto, "Ya Zahrat al-mada'in.");
+
+ }
+ catch(ReflectionTypeLoadException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.Types);
+ Console.WriteLine("Extra Exception Info: {0}", e.LoaderExceptions);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing TargetParameterCountException..");
+ throw new TargetParameterCountException("Then you shall DIE AGAIN!!", new Exception());
+
+ }
+ catch(TargetParameterCountException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing MissingManifestResourceException..");
+ throw new MissingManifestResourceException("No deaders today but walkin' ones, looks like!", new Exception());
+
+ }
+ catch(MissingManifestResourceException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing COMException..");
+ throw new COMException("A Space FOLD??!!", new Exception());
+
+ }
+ catch(COMException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing InvalidComObjectException..");
+ throw new InvalidComObjectException("At this altitude, it's IMPOSSIBLE!!", new Exception());
+
+ }
+ catch(InvalidComObjectException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing InvalidOleVariantTypeException..");
+ throw new InvalidOleVariantTypeException("It may be impossible but they did it!", new Exception());
+
+ }
+ catch(InvalidOleVariantTypeException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing MarshalDirectiveException..");
+ throw new MarshalDirectiveException("You point, I punch!");
+
+ }
+ catch(MarshalDirectiveException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing another MarshalDirectiveException..");
+ throw new MarshalDirectiveException("Minsc and Boo stand ready!", new Exception());
+
+ }
+ catch(MarshalDirectiveException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing SEHException..");
+ throw new SEHException("Full plate and packing steel!");
+
+ }
+ catch(SEHException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.CanResume());
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing another SEHException..");
+ throw new SEHException("A den of STINKIN' EVIL! Cover your nose Boo, we'll leave no crevice untouched!!", new Exception());
+
+ }
+ catch(SEHException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.CanResume());
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing SafeArrayRankMismatchException..");
+ throw new SafeArrayRankMismatchException("Evil around every corner.. Careful not to step in any!");
+
+ }
+ catch(SafeArrayRankMismatchException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing another SafeArrayRankMismatchException..");
+ throw new SafeArrayRankMismatchException("Cities always teem with evil and decay.. Let's give it a good shake and see what falls out!!", new Exception());
+
+ }
+ catch(SafeArrayRankMismatchException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing SafeArrayTypeMismatchException..");
+ throw new SafeArrayTypeMismatchException("Aww, we are all heroes, you and Boo and I, hamsters and rangers everywhere.. REJOICE!!", new Exception());
+
+ }
+ catch(SafeArrayTypeMismatchException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing VerificationException..");
+ throw new VerificationException("Butts will be liberally kicked when I get out!!", new Exception());
+
+ }
+ catch(VerificationException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ }
+
+ try
+ {
+ Console.WriteLine("Throwing TypeInitializationException..");
+ throw new TypeInitializationException("TheUnknownType", new Exception());
+
+ }
+ catch(TypeInitializationException e)
+ {
+ Console.WriteLine("Caught the exception: {0}", e.Message);
+ Console.WriteLine("Extra Exception Info: {0}", e.TypeName);
+ }
+
+ return Result;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/V1/SEH/coverage/Exceptions.csproj b/tests/src/baseservices/exceptions/regressions/V1/SEH/coverage/Exceptions.csproj
new file mode 100644
index 0000000000..37859e566e
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/V1/SEH/coverage/Exceptions.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="exceptions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/v1.0/15266.il b/tests/src/baseservices/exceptions/regressions/v1.0/15266.il
new file mode 100644
index 0000000000..8fe4cd5954
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/v1.0/15266.il
@@ -0,0 +1,73 @@
+// 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.
+
+// rethrow out of finally
+// expect throw System.Security.VerificationException
+
+.assembly extern legacy library mscorlib {}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+.assembly b15266 {}
+.module b15266.exe
+
+.class private auto ansi beforefieldinit test
+ extends [mscorlib]System.Object
+{
+ .method public static int32 Main() cil managed
+ {
+ .entrypoint
+
+ .try
+ {
+ call void test::test2()
+ ldstr "Fail 0"
+ call void [System.Console]System.Console::WriteLine(string)
+
+ leave FAIL
+ }
+
+ catch [mscorlib]System.InvalidCastException
+ {
+ pop
+ ldstr "Pass"
+ call void [System.Console]System.Console::WriteLine(string)
+ leave PASS
+ }
+ catch [mscorlib]System.DivideByZeroException
+ {
+ pop
+ ldstr "Fail 2"
+ call void [System.Console]System.Console::WriteLine(string)
+ leave FAIL
+ }
+
+
+FAIL:
+ ldc.i4 42
+ br END
+PASS:
+ ldc.i4 100
+END:
+ ret
+ }
+
+.method public hidebysig static void test2() cil managed
+ {
+ .try
+ {
+ newobj instance void [mscorlib]System.DivideByZeroException::.ctor()
+ throw
+ }
+ finally
+ {
+ newobj instance void [mscorlib]System.InvalidCastException::.ctor()
+ throw
+ }
+ ret
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/regressions/v1.0/15266.ilproj b/tests/src/baseservices/exceptions/regressions/v1.0/15266.ilproj
new file mode 100644
index 0000000000..53062b501a
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/v1.0/15266.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="15266.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/v1.0/19896.cs b/tests/src/baseservices/exceptions/regressions/v1.0/19896.cs
new file mode 100644
index 0000000000..c6e6e62365
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/v1.0/19896.cs
@@ -0,0 +1,34 @@
+// 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;
+
+public class b19896
+{
+ public static int Main(string[] args)
+ {
+ int retVal = 200;
+
+ try
+ {
+ try
+ {
+ throw new Exception();
+ }
+ catch
+ {
+ Type.GetType("System.Foo", true);
+ }
+ }
+
+ catch(System.TypeLoadException)
+ {
+ Console.WriteLine("TEST PASSED");
+ retVal = 100;
+ }
+
+ return retVal;
+ }
+}
+
+//EOF \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/v1.0/19896.csproj b/tests/src/baseservices/exceptions/regressions/v1.0/19896.csproj
new file mode 100644
index 0000000000..907b705873
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/v1.0/19896.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="19896.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/v4.0/640474/other.csproj b/tests/src/baseservices/exceptions/regressions/v4.0/640474/other.csproj
new file mode 100644
index 0000000000..20137e812d
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/v4.0/640474/other.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="other1.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/v4.0/640474/other1.cs b/tests/src/baseservices/exceptions/regressions/v4.0/640474/other1.cs
new file mode 100644
index 0000000000..3443e1cca3
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/v4.0/640474/other1.cs
@@ -0,0 +1,9 @@
+// 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;
+
+public class Other {
+ public static int field;
+}
diff --git a/tests/src/baseservices/exceptions/regressions/v4.0/640474/test640474.cs b/tests/src/baseservices/exceptions/regressions/v4.0/640474/test640474.cs
new file mode 100644
index 0000000000..90a558d7de
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/v4.0/640474/test640474.cs
@@ -0,0 +1,63 @@
+// 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.Runtime.CompilerServices;
+using System.Reflection;
+
+public class My
+{
+
+ static void bar()
+ {
+ Other.field = 123;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ static void foo(bool f)
+ {
+ if (f)
+ bar();
+ }
+
+ public static void Worker()
+ {
+ try
+ {
+ throw new Exception("Hello world");
+ }
+ finally
+ {
+ foo(false);
+ }
+ }
+
+ public static int Main()
+ {
+ try
+ {
+ typeof(My).GetMethod("Worker").Invoke(null, null);
+
+ Console.WriteLine("FAILED: No exception thrown.");
+ return 102;
+ }
+ catch (TargetInvocationException e)
+ {
+ Exception inner = e.GetBaseException();
+ Console.WriteLine(inner);
+
+ if (inner.Message == "Hello world")
+ {
+ Console.WriteLine("PASSED: Caught expected exception");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("FAILED: Wrong exception thrown. Expected: Exception with message 'Hello world'. Actual: " + inner.Message);
+ return 101;
+ }
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/regressions/v4.0/640474/test640474.csproj b/tests/src/baseservices/exceptions/regressions/v4.0/640474/test640474.csproj
new file mode 100644
index 0000000000..8f4a638874
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/v4.0/640474/test640474.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="test640474.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ <ProjectReference Include="other.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/v4.0/706099/ManagedCom.csproj b/tests/src/baseservices/exceptions/regressions/v4.0/706099/ManagedCom.csproj
new file mode 100644
index 0000000000..ea6eaf4947
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/v4.0/706099/ManagedCom.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="managedcom.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/v4.0/706099/managedcom.cs b/tests/src/baseservices/exceptions/regressions/v4.0/706099/managedcom.cs
new file mode 100644
index 0000000000..5eefd5d0c1
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/v4.0/706099/managedcom.cs
@@ -0,0 +1,62 @@
+// 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.Runtime.InteropServices;
+
+[ComVisible(true)]
+[ClassInterface(ClassInterfaceType.AutoDual)]
+[Guid("2A9F41BC-94F4-4889-9F8A-E0290CEF1177")]
+public class Class1COMInterop
+{
+ public delegate void Callback();
+
+ [DllImport("NativePinvoke", CallingConvention=CallingConvention.StdCall)]
+ public static extern void Native2(Callback call);
+
+ [DispId(1)]
+ public void Managed1()
+ {
+ Console.WriteLine("Inside Managed1");
+ try
+ {
+ Managed2();
+ }
+ finally
+ {
+ try
+ {
+ throw new ArgumentException();
+ }
+ catch(ArgumentException e)
+ {
+ Console.WriteLine("Managed1: Caught Exception: " + e);
+ }
+ }
+ }
+
+ public static void Managed2()
+ {
+ Console.WriteLine("Inside Managed2");
+
+ // pinvoke into Native2
+ Native2( new Callback(Managed3) );
+
+ }
+
+ public static void Managed3()
+ {
+ Console.WriteLine("Inside Managed3()");
+ Managed4();
+ }
+
+ public static void Managed4()
+ {
+
+ Console.WriteLine("Inside Managed4()");
+
+ // Throw IndexOutOfBounds
+ int[] IntArray = new int[10];
+ IntArray[11] = 5;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/whidbeyM3.2/151232.cs b/tests/src/baseservices/exceptions/regressions/whidbeyM3.2/151232.cs
new file mode 100644
index 0000000000..8daf378d51
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/whidbeyM3.2/151232.cs
@@ -0,0 +1,47 @@
+// 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;
+
+public class E<T> : Exception {
+ T fld;
+ public E(T x) { fld = x; }
+ public T Get() { return fld; }
+ public void Show() { Console.WriteLine("E<" + typeof(T) + ">(" + fld + ")"); }
+}
+
+
+public class D {
+ // Fifth test: polymorphic catch in shared code in a generic method
+ public static int Test5<T>(bool str,int x) {
+ if (x < 100)
+ if (str) throw new E<string>(x.ToString());
+ else throw new E<object>(x.ToString());
+ else
+ try {
+ Test5<T>(str,x-7);
+ }
+ catch (E<T> ei) { ei.Show(); }
+ catch (Exception e) {
+ Console.WriteLine("Not caught: "+e.GetType().ToString());
+ return -1;
+ }
+ return 100;
+ }
+
+}
+
+public class M {
+ public static int Main() {
+ M test = new M();
+ return test.Run();
+ }
+ public int Run(){
+ int val = D.Test5<string>(true,129);
+ if (val == 100)
+ val = D.Test5<object>(false,128);
+ else
+ D.Test5<object>(false,128);
+ return val;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/whidbeyM3.2/151232.csproj b/tests/src/baseservices/exceptions/regressions/whidbeyM3.2/151232.csproj
new file mode 100644
index 0000000000..18843974c0
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/whidbeyM3.2/151232.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="151232.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/whidbeybeta2/349379/349379.cs b/tests/src/baseservices/exceptions/regressions/whidbeybeta2/349379/349379.cs
new file mode 100644
index 0000000000..3c04afc558
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/whidbeybeta2/349379/349379.cs
@@ -0,0 +1,95 @@
+// 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;
+
+namespace TestCS
+{
+ public class Class8
+ {
+ static int returnCode = 99;
+ static string expectedExceptionString;
+ static string expectedOuterExceptionString = "Foobar";
+
+ static public int Main(String[] args)
+ {
+ Object foo = null;
+ try
+ {
+ foo.GetType();
+ }
+ catch(Exception e)
+ {
+ expectedExceptionString = e.Message;
+ }
+
+ try
+ {
+ DoIt();
+ }
+ catch(Exception e)
+ {
+ if (e.Message != expectedOuterExceptionString)
+ returnCode = 98;
+
+ Console.WriteLine("Outer Exception Message Found: " + e.Message);
+ Console.WriteLine("Outer Exception Message Expected: " + expectedOuterExceptionString);
+ }
+
+ if (returnCode == 100)
+ Console.WriteLine("Test PASSED");
+ else
+ Console.WriteLine("Test FAILED");
+
+ return returnCode;
+ }
+
+ static public void DoIt()
+ {
+ try
+ {
+ ThrowException();
+ }
+ finally
+ {
+ Foobar();
+ }
+ }
+
+ static private void ThrowException()
+ {
+ try
+ {
+ throw new Exception(expectedOuterExceptionString);
+ }
+ catch(Exception)
+ {
+ throw;
+ }
+ }
+
+ static public void Foobar()
+ {
+ Object foo = null;
+
+ try
+ {
+ foo.GetType();
+ }
+
+ catch(Exception e)
+ {
+ // The message here should be "Object reference not set to an instance of an object."
+ // But it displays "Foobar" instead
+ //
+ if (e.Message != expectedExceptionString)
+ returnCode = 98;
+ else
+ returnCode = 100;
+
+ Console.WriteLine("Message Found: " + e.Message);
+ Console.WriteLine("Message Expected: " + expectedExceptionString);
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/exceptions/regressions/whidbeybeta2/349379/349379.csproj b/tests/src/baseservices/exceptions/regressions/whidbeybeta2/349379/349379.csproj
new file mode 100644
index 0000000000..9f6b97c69e
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/whidbeybeta2/349379/349379.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="349379.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/whidbeybeta2/366085/366085.cs b/tests/src/baseservices/exceptions/regressions/whidbeybeta2/366085/366085.cs
new file mode 100644
index 0000000000..7b15c6afae
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/whidbeybeta2/366085/366085.cs
@@ -0,0 +1,41 @@
+// 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.Threading;
+
+public class MainClass
+{
+ static public int Main(String[] args)
+ {
+ int returnCode = 99;
+
+ try
+ {
+ Convert.FromBase64String(null);
+ }
+ catch (ArgumentNullException e)
+ {
+ Console.WriteLine("Caught ArgumentNullException");
+ Console.WriteLine(e.Message);
+ // the error message may be in the debug pack
+ if (((e.Message.IndexOf("Value cannot be null.") >= 0 && e.Message.IndexOf("Parameter name:") >= 0) ||
+ (e.Message.IndexOf("[ArgumentNull_Generic]") >= 0)))
+ returnCode = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught wrong Exception: " + e.Message);
+ returnCode = 98;
+ }
+
+ if (returnCode == 100)
+ Console.WriteLine("Test PASSED");
+ else
+ Console.WriteLine("Test FAILED");
+ return returnCode;
+ }
+
+}
+
+
diff --git a/tests/src/baseservices/exceptions/regressions/whidbeybeta2/366085/366085.csproj b/tests/src/baseservices/exceptions/regressions/whidbeybeta2/366085/366085.csproj
new file mode 100644
index 0000000000..91b60f6918
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/whidbeybeta2/366085/366085.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="366085.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/whidbeym3.3/106011/106011.cs b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/106011/106011.cs
new file mode 100644
index 0000000000..d949e776d9
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/106011/106011.cs
@@ -0,0 +1,68 @@
+// 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;
+
+public class GenException<T> : Exception {}
+
+public class Gen
+{
+ public static void ExceptionTest<Ex,T>(Ex e) where Ex : Exception where T : Exception
+ {
+ try
+ {
+ throw e;
+ }
+ catch(T)
+ {
+ Console.WriteLine("Caught Wrong Exception");
+ Test.Eval(false);
+ }
+ catch(Ex E)
+ {
+ Test.Eval(Object.ReferenceEquals(e,E));
+
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ExceptionTest<Exception,InvalidOperationException>(new Exception());
+ Gen.ExceptionTest<Exception,GenException<int>>(new Exception());
+ Gen.ExceptionTest<Exception,GenException<string>>(new Exception());
+ Gen.ExceptionTest<GenException<int>,GenException<string>>(new GenException<int>());
+ Gen.ExceptionTest<GenException<string>,GenException<int>>(new GenException<string>());
+ Gen.ExceptionTest<GenException<object>,GenException<string>>(new GenException<object>());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 0;
+ }
+ }
+
+}
+
diff --git a/tests/src/baseservices/exceptions/regressions/whidbeym3.3/106011/106011.csproj b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/106011/106011.csproj
new file mode 100644
index 0000000000..cd4e50aaf2
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/106011/106011.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="106011.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/whidbeym3.3/293674/ReproTrusted.csproj b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/293674/ReproTrusted.csproj
new file mode 100644
index 0000000000..5a40aae039
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/293674/ReproTrusted.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="securedispatcher.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/whidbeym3.3/293674/securedispatcher.cs b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/293674/securedispatcher.cs
new file mode 100644
index 0000000000..d292b005a3
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/293674/securedispatcher.cs
@@ -0,0 +1,45 @@
+// 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;
+
+namespace Avalon.Secure
+{
+
+ public class Foo
+ {
+
+ static public void FooMethod(object sender, EventArgs e)
+ {
+ bar.BarEvent -= new EventHandler(Foo.FooMethod);
+ bar.OnBarEvent();
+ }
+
+
+ ///<summary>
+ ///</summary>
+ static public Bar bar = null;
+
+ }
+
+
+
+
+ public class Bar
+ {
+ public Bar(){}
+
+ public event EventHandler BarEvent;
+
+ public void OnBarEvent()
+ {
+ if (BarEvent != null)
+ BarEvent(this, EventArgs.Empty);
+ }
+
+
+ }
+
+
+}
+
diff --git a/tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/302680.cs b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/302680.cs
new file mode 100644
index 0000000000..29718d0349
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/302680.cs
@@ -0,0 +1,23 @@
+// 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;
+
+public class xa {
+
+ public static int Main(string[] args) {
+
+ try {
+
+ x.doX(null);
+
+ } catch(NullReferenceException) {
+ //Expected
+ return 100;
+ }
+ return 0;
+ }
+
+}
+
+ \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/302680.csproj b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/302680.csproj
new file mode 100644
index 0000000000..6b288989a6
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/302680.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="302680.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="data.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/data.cs b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/data.cs
new file mode 100644
index 0000000000..f46490a449
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/data.cs
@@ -0,0 +1,16 @@
+// 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;
+
+public class x {
+
+ public static void doX(x comp) {
+ comp.Add(null, null);
+ }
+
+ public virtual void Add(Object o1, Object o2) {
+
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/data.csproj b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/data.csproj
new file mode 100644
index 0000000000..7c96e7e5cc
--- /dev/null
+++ b/tests/src/baseservices/exceptions/regressions/whidbeym3.3/302680/data.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="data.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/sharedexceptions/emptystacktrace/OOMException01.csproj b/tests/src/baseservices/exceptions/sharedexceptions/emptystacktrace/OOMException01.csproj
new file mode 100644
index 0000000000..d20398d9be
--- /dev/null
+++ b/tests/src/baseservices/exceptions/sharedexceptions/emptystacktrace/OOMException01.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>-trustedexe</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="oomexception01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/sharedexceptions/emptystacktrace/oomexception01.cs b/tests/src/baseservices/exceptions/sharedexceptions/emptystacktrace/oomexception01.cs
new file mode 100644
index 0000000000..ee24da9b8f
--- /dev/null
+++ b/tests/src/baseservices/exceptions/sharedexceptions/emptystacktrace/oomexception01.cs
@@ -0,0 +1,62 @@
+// 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.Diagnostics;
+
+public class SharedExceptions
+{
+ public int retVal =0;
+
+ public static int Main()
+ {
+ Console.WriteLine("Test that StackTrace for OOM is proper if memory is available");
+ SharedExceptions test = new SharedExceptions();
+ test.RunTest();
+ Console.WriteLine(100 == test.retVal ? "Test Passed":"Test Failed");
+ return test.retVal;
+ }
+
+ public void RunTest()
+ {
+ CreateAndThrow();
+ }
+
+ public void CreateAndThrow()
+ {
+ string currStack;
+
+ try
+ {
+ throw new Exception();
+ }
+ catch(Exception e)
+ {
+ currStack = e.StackTrace;
+ }
+
+ try
+ {
+ Guid[] g = new Guid[Int32.MaxValue];
+ }
+ catch(OutOfMemoryException e)
+ {
+ retVal = 100;
+
+ Console.WriteLine("Caught OOM");
+
+ if(e.StackTrace.ToString().Substring(0, e.StackTrace.Length - 8) != currStack.Substring(0, currStack.Length - 8))
+ {
+ Console.WriteLine("Actual Exception Stack Trace:");
+ Console.WriteLine(e.StackTrace);
+ Console.WriteLine();
+ Console.WriteLine("Expected Stack Trace:");
+ Console.WriteLine(currStack.ToString());
+ retVal = 50;
+ }
+ }
+
+ }
+
+}
+
diff --git a/tests/src/baseservices/exceptions/simple/ArrayInit.cs b/tests/src/baseservices/exceptions/simple/ArrayInit.cs
new file mode 100644
index 0000000000..3871962560
--- /dev/null
+++ b/tests/src/baseservices/exceptions/simple/ArrayInit.cs
@@ -0,0 +1,72 @@
+// 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 TestLibrary;
+
+public class ArrayInit {
+
+ public static int Main(string[] args)
+ {
+
+ ArrayInit ai = new ArrayInit();
+ TestFramework.BeginTestCase("Exception thrown in default ctor of a valuetype during Array.Initialize");
+ if (ai.RunTests())
+ return 100;
+ else
+ return 0;
+ }
+
+ public bool RunTests()
+ {
+ bool retVal = true;
+ retVal &= PosTest1();
+ retVal &= PosTest2();
+ TestFramework.LogInformation(retVal ? "PASS" : "FAIL");
+ return retVal;
+ }
+
+ public bool PosTest1()
+ {
+ TestFramework.BeginScenario("PosTest1: Initialize on vector of value-type, where default ctor throws");
+ bool retVal = true;
+ try
+ {
+ VT[] vecVT = new VT[5];
+ vecVT.Initialize();
+ TestFramework.LogError("001", "Expected exception to be thrown from Initialize");
+ retVal = false;
+ }
+ catch (NotSupportedException)
+ {
+ }
+ catch (Exception e)
+ {
+ TestFramework.LogError("002", "Unexpected exception: " + e.ToString());
+ retVal = false;
+ }
+ return retVal;
+ }
+
+ public bool PosTest2()
+ {
+ TestFramework.BeginScenario("PosTest2: Initialize on multi-dimensional array of value-type, where default ctor throws");
+ bool retVal = true;
+ try
+ {
+ VT[,] arrVT = new VT[5,10];
+ arrVT.Initialize();
+ TestFramework.LogError("001", "Expected exception to be thrown from Initialize");
+ retVal = false;
+ }
+ catch (NotSupportedException)
+ {
+ }
+ catch (Exception e)
+ {
+ TestFramework.LogError("002", "Unexpected exception: " + e.ToString());
+ retVal = false;
+ }
+ return retVal;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/simple/ArrayInit.csproj b/tests/src/baseservices/exceptions/simple/ArrayInit.csproj
new file mode 100644
index 0000000000..49cbf9b91e
--- /dev/null
+++ b/tests/src/baseservices/exceptions/simple/ArrayInit.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ArrayInit.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="VT.ilproj" />
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/simple/HardwareEh.cs b/tests/src/baseservices/exceptions/simple/HardwareEh.cs
new file mode 100644
index 0000000000..3d5cd9a2ad
--- /dev/null
+++ b/tests/src/baseservices/exceptions/simple/HardwareEh.cs
@@ -0,0 +1,331 @@
+// 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.Collections;
+using System.Collections.Generic;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// DataMisalignment
+// NullRef (generic, nullable, object)
+// Divide by zero (integral)
+// Overflow (integral)
+// Stack overflow
+// OOM
+
+// Array out of bounds (single, multi, jagged)
+// Array null ref (single, multi, jagged)
+
+public class HardwareEh
+{
+ public const long c_VALUE = 34252;
+ public delegate bool TestDelegate();
+
+ public static int Main()
+ {
+ HardwareEh e = new HardwareEh();
+
+ TestLibrary.TestFramework.BeginTestCase("Hardware exceptions: handled");
+
+ if (e.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Postive]");
+ retVal = PosTest1() && retVal;
+ retVal = PosTest2() && retVal;
+ retVal = PosTest3() && retVal;
+ retVal = PosTest4() && retVal;
+ retVal = PosTest5() && retVal;
+ retVal = PosTest6() && retVal;
+ retVal = PosTest7() && retVal;
+ retVal = PosTest8() && retVal;
+ retVal = PosTest9() && retVal;
+// The current stack overflow behavior is to rip the process
+// retVal = PosTest10() && retVal;
+// retVal = PosTest11() && retVal;
+ retVal = PosTest12() && retVal;
+ retVal = PosTest13() && retVal;
+ retVal = PosTest14() && retVal;
+ retVal = PosTest15() && retVal;
+ retVal = PosTest16() && retVal;
+ retVal = PosTest17() && retVal;
+ retVal = PosTest18() && retVal;
+ retVal = PosTest19() && retVal;
+ retVal = PosTest20() && retVal;
+
+ return retVal;
+ }
+
+ public bool PosTest1() { return DataMisalign(1, false); }
+ public bool PosTest2() { return DataMisalign(2, true); }
+ public bool PosTest3() { return ExceptionTest(3, "NullReference", typeof(NullReferenceException),
+ delegate()
+ {
+ object o = null;
+ o.ToString();
+ return true;
+ } ); }
+ public bool PosTest4() { return ExceptionTest(4, "NullReference (generic)", typeof(NullReferenceException),
+ delegate()
+ {
+ List<int> l = null;
+ l.ToString();
+ return true;
+ } ); }
+ public bool PosTest5() { return ExceptionTest(5, "NullReference (nullable)", typeof(InvalidOperationException),
+ delegate()
+ {
+ int? i = null;
+ i.Value.ToString();
+ return true;
+ } ); }
+ public bool PosTest6() { return ExceptionTest(6, "DivideByZero (int64)", typeof(DivideByZeroException),
+ delegate()
+ {
+ Int64 i = 10;
+ Int64 j = 0;
+ Int64 k = i / j;
+ return true;
+ } ); }
+ public bool PosTest7() { return ExceptionTest(7, "DivideByZero (int32)", typeof(DivideByZeroException),
+ delegate()
+ {
+ Int32 i = 10;
+ Int32 j = 0;
+ Int32 k = i / j;
+ return true;
+ } ); }
+ public bool PosTest8() { return ExceptionTest(8, "OverflowException (int64)", typeof(OverflowException), new TestDelegate(ILHelper.Int64Overflow) ); }
+ public bool PosTest9() { return ExceptionTest(9, "OverflowException (int32)", typeof(OverflowException), new TestDelegate(ILHelper.Int32Overflow) ); }
+// public bool PosTest10() { return ExceptionTest(10, "StackOverflow", typeof(StackOverflowException), new TestDelegate( GobbleStack )); }
+/* public bool PosTest11() { return ExceptionTest(11, "OutOfMemory", typeof(OutOfMemoryException),
+ delegate()
+ {
+ List<object> list;
+ list = new List<object>();
+ while(true)
+ {
+ // allocate memory (86 meg chunks)
+ list.Add( new byte[8388608]);
+ }
+ } ); } */
+ public bool PosTest12() { return ExceptionTest(12, "IndexOutOfRange (single dim [less than])", typeof(IndexOutOfRangeException),
+ delegate()
+ {
+ int[] arr = new int[10];
+ int index = -1;
+ arr[index] = 0;
+ return true;
+ } ); }
+ public bool PosTest13() { return ExceptionTest(13, "IndexOutOfRange (single dim [greater than])", typeof(IndexOutOfRangeException),
+ delegate()
+ {
+ int[] arr = new int[10];
+ int index = 11;
+ arr[index] = 0;
+ return true;
+ } ); }
+ public bool PosTest14() { return ExceptionTest(14, "IndexOutOfRange (multi dim [less than])", typeof(IndexOutOfRangeException),
+ delegate()
+ {
+ int[,] arr = new int[10,10];
+ int index = -1;
+ arr[0,index] = 0;
+ return true;
+ } ); }
+ public bool PosTest15() { return ExceptionTest(15, "IndexOutOfRange (multi dim [greater than])", typeof(IndexOutOfRangeException),
+ delegate()
+ {
+ int[,] arr = new int[10,10];
+ int index = 11;
+ arr[index,0] = 0;
+ return true;
+ } ); }
+ public bool PosTest16() { return ExceptionTest(16, "IndexOutOfRange (jagged [less than])", typeof(IndexOutOfRangeException),
+ delegate()
+ {
+ int[][] arr = new int[10][];
+ int index = -1;
+ arr[0] = new int[10];
+ arr[0][index] = 0;
+ return true;
+ } ); }
+ public bool PosTest17() { return ExceptionTest(17, "IndexOutOfRange (jagged [greater than])", typeof(IndexOutOfRangeException),
+ delegate()
+ {
+ int[][] arr = new int[10][];
+ int index = 11;
+ arr[index] = new int[10];
+ return true;
+ } ); }
+ public bool PosTest18() { return ExceptionTest(18, "NullReference (single dim)", typeof(NullReferenceException),
+ delegate()
+ {
+ int[] arr = null;
+ int index = 2;
+ arr[index] = 0;
+ return true;
+ } ); }
+ public bool PosTest19() { return ExceptionTest(19, "NullReference (multi dim)", typeof(NullReferenceException),
+ delegate()
+ {
+ int[,] arr = null;
+ int index = 2;
+ arr[index,0] = 0;
+ return true;
+ } ); }
+ public bool PosTest20() { return ExceptionTest(20, "NullReference (jagged)", typeof(NullReferenceException),
+ delegate()
+ {
+ int[][] arr = new int[10][];
+ int index = 2;
+ arr[index][0] = 0;
+ return true;
+ } ); }
+
+ public bool DataMisalign(int id, bool getter)
+ {
+ bool retVal = true;
+ long misAlignedField = 0;
+ MyStruct m;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest"+id+": "+ (getter?"Get":"Set") +" misaligned field expect DataMisalignment Exception (IA64 only)");
+
+ try
+ {
+ m = new MyStruct();
+
+ if (getter)
+ {
+ misAlignedField = m.MisalignedField;
+ }
+ else
+ {
+ m.MisalignedField = c_VALUE;
+ }
+
+ if (IsIA64())
+ {
+ TestLibrary.TestFramework.LogError("002", "DataMisalignedException expected");
+ retVal = false;
+ }
+
+ // need to get it to validate that it is right
+ if (!getter) misAlignedField = m.MisalignedField;
+
+ if (c_VALUE != misAlignedField)
+ {
+ TestLibrary.TestFramework.LogError("001", "Incorrect value: Expected("+c_VALUE+") Actual("+misAlignedField+")");
+ retVal = false;
+ }
+ }
+ catch (DataMisalignedException e)
+ {
+ // expected on IA64
+ if (IsIA64())
+ {
+ TestLibrary.TestFramework.LogInformation("Catch DataMisalignedException as expected");
+ }
+ else
+ {
+ TestLibrary.TestFramework.LogError("003", "Unexpected exception: " + e);
+ retVal = false;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("004", "Unexpected exception: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+ public bool ExceptionTest(int id, string msg, Type ehType, TestDelegate d)
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest"+id+": " + msg);
+
+ try
+ {
+ retVal = d();
+
+ TestLibrary.TestFramework.LogError("10" + id, "Function should have thrown: " + ehType);
+ retVal = false;
+ }
+ catch (Exception e)
+ {
+ if (ehType != e.GetType())
+ {
+ TestLibrary.TestFramework.LogError("004", "Unexpected exception: " + e);
+ retVal = false;
+ }
+ }
+
+ return retVal;
+ }
+
+ public bool IsIA64()
+ {
+ return false;
+ }
+
+ public volatile static int volatileReadWrite = 0;
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ public static bool GobbleStack()
+ {
+ #pragma warning disable 0168
+ MyStruct s1;
+ MyStruct s2;
+ #pragma warning restore 0168
+
+ return GobbleStack();
+
+ #pragma warning disable 0162
+ // avoid tail call optimizations
+ volatileReadWrite++;
+ #pragma warning restore 0162
+ }
+}
+
+[StructLayout(LayoutKind.Explicit)]
+public class MyStruct
+{
+ [FieldOffset(1)]
+ public long MisalignedField = HardwareEh.c_VALUE;
+}
+
+#pragma warning disable 0169
+public struct MyLargeStruct
+{
+ long l0,l1,l2,l3,l4,l5,l6,l7,l8,l9;
+ long l10,l11,l12,l13,l14,l15,l16,l17,l18,l19;
+ long l20,l21,l22,l23,l24,l25,l26,l27,l28,l29;
+ long l30,l31,l32,l33,l34,l35,l36,l37,l38,l39;
+ long l40,l41,l42,l43,l44,l45,l46,l47,l48,l49;
+ double d0,d1,d2,d3,d4,d5,d6,d7,d8,d9;
+ double d10,d11,d12,d13,d14,d15,d16,d17,d18,d19;
+ double d20,d21,d22,d23,d24,d25,d26,d27,d28,d29;
+ double d30,d31,d32,d33,d34,d35,d36,d37,d38,d39;
+ double d40,d41,d42,d43,d44,d45,d46,d47,d48,d49;
+}
+#pragma warning restore 0169
diff --git a/tests/src/baseservices/exceptions/simple/HardwareEh.csproj b/tests/src/baseservices/exceptions/simple/HardwareEh.csproj
new file mode 100644
index 0000000000..50ed947206
--- /dev/null
+++ b/tests/src/baseservices/exceptions/simple/HardwareEh.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="HardwareEh.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ <ProjectReference Include="ILHelper.ilproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/simple/ILHelper.cs b/tests/src/baseservices/exceptions/simple/ILHelper.cs
new file mode 100644
index 0000000000..c243f7dd06
--- /dev/null
+++ b/tests/src/baseservices/exceptions/simple/ILHelper.cs
@@ -0,0 +1,23 @@
+// 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;
+
+public class ILHelper
+{
+ public static bool Int32Overflow()
+ {
+ int i = Int32.MaxValue;
+ int j = 2;
+ int k = i + j;
+ return true;
+ }
+ public static bool Int64Overflow()
+ {
+ Int64 i = Int64.MaxValue;
+ Int64 j = 2;
+ Int64 k = i * j;
+ return true;
+ }
+}
diff --git a/tests/src/baseservices/exceptions/simple/ILHelper.il b/tests/src/baseservices/exceptions/simple/ILHelper.il
new file mode 100644
index 0000000000..58752bad24
--- /dev/null
+++ b/tests/src/baseservices/exceptions/simple/ILHelper.il
@@ -0,0 +1,57 @@
+// 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.
+
+.assembly extern mscorlib {}
+.assembly ILHelper {}
+.module ILHelper.dll
+
+.class public auto ansi beforefieldinit ILHelper
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig static bool Int32Overflow() cil managed
+ {
+ .locals init (int32 V_0,
+ int32 V_1,
+ int32 V_2)
+ ldc.i4 0x7fffffff
+ stloc.0
+ ldc.i4.2
+ stloc.1
+ ldloc.0
+ ldloc.1
+ // changed to include .ovf
+ add.ovf
+ stloc.2
+ ldc.i4.1
+ ret
+ }
+
+ .method public hidebysig static bool Int64Overflow() cil managed
+ {
+ .locals init (int64 V_0,
+ int64 V_1,
+ int64 V_2)
+ ldc.i8 0x7fffffffffffffff
+ stloc.0
+ ldc.i4.2
+ conv.i8
+ stloc.1
+ ldloc.0
+ ldloc.1
+ // changed to include .ovf
+ mul.ovf
+ stloc.2
+ ldc.i4.1
+ ret
+ }
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ ldarg.0
+ call instance void [mscorlib]System.Object::.ctor()
+ ret
+ }
+
+}
diff --git a/tests/src/baseservices/exceptions/simple/ILHelper.ilproj b/tests/src/baseservices/exceptions/simple/ILHelper.ilproj
new file mode 100644
index 0000000000..7f927c1665
--- /dev/null
+++ b/tests/src/baseservices/exceptions/simple/ILHelper.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="ILHelper.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/simple/VT.il b/tests/src/baseservices/exceptions/simple/VT.il
new file mode 100644
index 0000000000..0c2c8d6800
--- /dev/null
+++ b/tests/src/baseservices/exceptions/simple/VT.il
@@ -0,0 +1,67 @@
+// 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.
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 2.0.50727.42
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+
+
+// Metadata version: v2.0.50727
+.assembly extern mscorlib
+{
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+ .ver 2:0:0:0
+}
+.assembly VT
+{
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module VT.dll
+// MVID: {54DC34D8-2D7D-429C-93F5-6A77ED223377}
+.imagebase 0x00400000
+.file alignment 0x00000200
+.stackreserve 0x00100000
+.subsystem 0x0003 // WINDOWS_CUI
+.corflags 0x00000001 // ILONLY
+// Image base: 0x00E60000
+
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public sequential ansi sealed beforefieldinit VT
+ extends [mscorlib]System.ValueType
+{
+ .field public int32 x
+ .field public float64 y
+ .field public string z
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 35 (0x23)
+ .maxstack 8
+ IL_0000: nop
+ IL_0001: ldarg.0
+ IL_0002: ldc.i4.2
+ IL_0003: stfld int32 VT::x
+ IL_0008: ldarg.0
+ IL_0009: ldc.r8 3.1400000000000001
+ IL_0012: stfld float64 VT::y
+ IL_0017: ldarg.0
+ IL_0018: ldstr "England expects that every man will do his duty."
+ IL_001d: stfld string VT::z
+ IL_0022: newobj instance void [mscorlib]System.NotSupportedException::.ctor()
+ IL_0027: throw
+ } // end of method VT::.ctor
+
+} // end of class VT
+
+
+// =============================================================
+
+// *********** DISASSEMBLY COMPLETE ***********************
+// WARNING: Created Win32 resource file VT.res
diff --git a/tests/src/baseservices/exceptions/simple/VT.ilproj b/tests/src/baseservices/exceptions/simple/VT.ilproj
new file mode 100644
index 0000000000..e3756d7168
--- /dev/null
+++ b/tests/src/baseservices/exceptions/simple/VT.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="VT.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/simple/fault.il b/tests/src/baseservices/exceptions/simple/fault.il
new file mode 100644
index 0000000000..7938f1c3d2
--- /dev/null
+++ b/tests/src/baseservices/exceptions/simple/fault.il
@@ -0,0 +1,92 @@
+// 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.
+
+.assembly extern legacy library mscorlib {}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+
+.assembly 'fault' {}
+
+.class auto ansi Fault
+{
+ .method public static int32 Main(class [mscorlib]System.String[] args) il managed
+ {
+ .entrypoint
+ .locals init (int32 V_0)
+ ldc.i4 3
+ stloc.0
+
+ try_begin:
+ ldstr "message"
+ newobj instance void [mscorlib]System.Exception::.ctor(class [mscorlib]System.String)
+ throw
+ leave.s try_end
+
+ fault_begin:
+ ldstr "in fault block."
+ call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
+ ldloc.0
+ ldc.i4 1
+ sub
+ stloc.0
+ endfinally
+
+ filter_begin:
+ pop
+ ldstr "in filter."
+ call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
+ ldloc.0
+ ldc.i4 1
+ sub
+ stloc.0
+ ldc.i4 1
+ endfilter
+
+ except_begin:
+ call void [mscorlib]System.GC::Collect()
+ castclass [mscorlib]System.Exception
+ callvirt instance class [mscorlib]System.String [mscorlib]System.Exception::get_Message()
+ call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
+
+ ldstr "in except block."
+ call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
+ ldloc.0
+ ldc.i4 1
+ sub
+ stloc.0
+ leave.s try_end
+
+ try_end:
+ ldloc.0
+ ldc.i4.0
+ bne.un.s FAIL
+
+ ldstr "test passed."
+ call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
+ ldc.i4 0x64
+ ret
+
+ FAIL:
+ ldstr "test failed."
+ call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
+
+ ldloc.0
+ ret
+
+ .try try_begin to fault_begin fault handler fault_begin to filter_begin
+ .try try_begin to filter_begin filter filter_begin handler except_begin to try_end
+ }
+
+ .method public specialname rtspecialname instance void .ctor() il managed
+ {
+ ldarg.0
+ call instance void [mscorlib]System.Object::.ctor()
+ ret
+ }
+
+}
+
diff --git a/tests/src/baseservices/exceptions/simple/fault.ilproj b/tests/src/baseservices/exceptions/simple/fault.ilproj
new file mode 100644
index 0000000000..454e265e8b
--- /dev/null
+++ b/tests/src/baseservices/exceptions/simple/fault.ilproj
@@ -0,0 +1,42 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="fault.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/simple/finally.cs b/tests/src/baseservices/exceptions/simple/finally.cs
new file mode 100644
index 0000000000..d8d72c8933
--- /dev/null
+++ b/tests/src/baseservices/exceptions/simple/finally.cs
@@ -0,0 +1,188 @@
+// 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.Threading;
+
+public class Finally
+{
+ public static int Main()
+ {
+ Finally f = new Finally();
+
+ TestLibrary.TestFramework.BeginTestCase("Finally blocks");
+
+ if (f.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Postive]");
+ retVal = PosTest1() && retVal;
+ retVal = PosTest2() && retVal;
+ retVal = PosTest3() && retVal;
+
+ return retVal;
+ }
+
+ public bool PosTest1()
+ {
+ bool retVal = true;
+ int stage = 0;
+
+ TestLibrary.TestFramework.LogInformation("PosTest1: Outer finally");
+
+ try
+ {
+ stage++; //1
+ try
+ {
+ stage++; //2
+ throw new ArgumentException();
+ }
+ catch (ArgumentException)
+ {
+ if (2 != stage)
+ {
+ TestLibrary.TestFramework.LogError("000", "Catch block executed in wrong order: Expected(2) Actual("+stage+")");
+ retVal = false;
+ }
+ stage++; //3
+ }
+ }
+ finally
+ {
+ if (3 != stage)
+ {
+ TestLibrary.TestFramework.LogError("000", "Finally block executed in wrong order: Expected(3) Actual("+stage+")");
+ retVal = false;
+ }
+ stage++; //4
+ }
+
+ if (4 != stage)
+ {
+ TestLibrary.TestFramework.LogError("000", "Finally/Catch block executed too many times: Expected(4) Actual("+stage+")");
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+ public bool PosTest2()
+ {
+ bool retVal = true;
+ int stage = 0;
+
+ TestLibrary.TestFramework.LogInformation("PosTest2: Cascade finally");
+
+ try
+ {
+ stage++; //1
+ throw new ArgumentException();
+ }
+ catch (ArgumentException)
+ {
+ if (1 != stage)
+ {
+ TestLibrary.TestFramework.LogError("000", "Catch block executed in wrong order: Expected(1) Actual("+stage+")");
+ retVal = false;
+ }
+ stage++; //2
+ }
+ finally
+ {
+ if (2 != stage)
+ {
+ TestLibrary.TestFramework.LogError("000", "Finally block executed in wrong order: Expected(2) Actual("+stage+")");
+ retVal = false;
+ }
+ stage++; //3
+ }
+
+ if (3 != stage)
+ {
+ TestLibrary.TestFramework.LogError("000", "Finally/Catch block executed too many times: Expected(3) Actual("+stage+")");
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+ public bool PosTest3()
+ {
+ bool retVal = true;
+ int stage = 0;
+
+ TestLibrary.TestFramework.LogInformation("PosTest2: Nested finally");
+
+ try
+ {
+ stage++; //1
+ throw new ArgumentException();
+ }
+ catch (ArgumentException)
+ {
+ if (1 != stage)
+ {
+ TestLibrary.TestFramework.LogError("000", "Catch block executed in wrong order: Expected(1) Actual("+stage+")");
+ retVal = false;
+ }
+ stage++; //2
+
+ try
+ {
+ stage++; //3
+ throw new ArgumentException();
+ }
+ catch (ArgumentException)
+ {
+ if (3 != stage)
+ {
+ TestLibrary.TestFramework.LogError("000", "Catch block executed in wrong order: Expected(3) Actual("+stage+")");
+ retVal = false;
+ }
+ stage++; //4
+ }
+ finally
+ {
+ if (4 != stage)
+ {
+ TestLibrary.TestFramework.LogError("000", "Finally block executed in wrong order: Expected(4) Actual("+stage+")");
+ retVal = false;
+ }
+ stage++; //5
+ }
+ }
+ finally
+ {
+ if (5 != stage)
+ {
+ TestLibrary.TestFramework.LogError("000", "Finally block executed in wrong order: Expected(5) Actual("+stage+")");
+ retVal = false;
+ }
+ stage++; //6
+ }
+
+ if (6 != stage)
+ {
+ TestLibrary.TestFramework.LogError("000", "Finally/Catch block executed too many times: Expected(6) Actual("+stage+")");
+ retVal = false;
+ }
+
+ return retVal;
+ }
+}
diff --git a/tests/src/baseservices/exceptions/simple/finally.csproj b/tests/src/baseservices/exceptions/simple/finally.csproj
new file mode 100644
index 0000000000..700fd91d5c
--- /dev/null
+++ b/tests/src/baseservices/exceptions/simple/finally.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="finally.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/Baadbaad.cs b/tests/src/baseservices/exceptions/unittests/Baadbaad.cs
new file mode 100644
index 0000000000..5fa72012d9
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/Baadbaad.cs
@@ -0,0 +1,95 @@
+// 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;
+
+//
+// main
+//
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new BaadbaadTest().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+public class BaadbaadTest
+{
+ Trace _trace;
+ public int Run()
+ {
+ _trace = new Trace("BaadbaadTest", "1234");
+ try
+ {
+ DoStuff();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("4");
+ }
+ return _trace.Match();
+ }
+ void DoStuff()
+ {
+ try
+ {
+ try
+ {
+ try
+ {
+ throw new Exception();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("1");
+ throw;
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("2");
+ throw;
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("3");
+ throw;
+ }
+ }
+}
+
diff --git a/tests/src/baseservices/exceptions/unittests/Baadbaad.csproj b/tests/src/baseservices/exceptions/unittests/Baadbaad.csproj
new file mode 100644
index 0000000000..f1241cc770
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/Baadbaad.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="baadbaad.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/BaseClass.csproj b/tests/src/baseservices/exceptions/unittests/BaseClass.csproj
new file mode 100644
index 0000000000..b8a07d9c9b
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/BaseClass.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="baseclass.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/CollidedUnwind.cs b/tests/src/baseservices/exceptions/unittests/CollidedUnwind.cs
new file mode 100644
index 0000000000..ea421ae79f
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/CollidedUnwind.cs
@@ -0,0 +1,165 @@
+// 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;
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new CollidedUnwindTest().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+public class CollidedUnwindTest
+{
+ class ExType1 : Exception
+ {
+ }
+
+ class ExType2 : Exception
+ {
+ }
+
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("CollidedUnwindTest", "0123456789ABCDE");
+
+ try
+ {
+ _trace.Write("0");
+ Foo();
+ }
+ catch (ExType2 e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("E");
+ }
+
+ return _trace.Match();
+ }
+
+ void Foo()
+ {
+ try
+ {
+ _trace.Write("1");
+ FnAAA();
+ }
+ catch (ExType1 e)
+ {
+ Console.WriteLine(e);
+ _trace.Write(" BAD ");
+ }
+ }
+
+ void FnAAA()
+ {
+ try
+ {
+ _trace.Write("2");
+ FnBBB();
+ }
+ finally
+ {
+ _trace.Write("D");
+ }
+ }
+
+ void FnBBB()
+ {
+ try
+ {
+ _trace.Write("3");
+ Bar();
+ }
+ finally
+ {
+ _trace.Write("C");
+ }
+ }
+
+ void Bar()
+ {
+ try
+ {
+ _trace.Write("4");
+ FnCCC();
+ }
+ finally
+ {
+ _trace.Write("B");
+ throw new ExType2();
+ }
+ }
+
+ void FnCCC()
+ {
+ try
+ {
+ _trace.Write("5");
+ FnDDD();
+ }
+ finally
+ {
+ _trace.Write("A");
+ }
+ }
+
+ void FnDDD()
+ {
+ try
+ {
+ _trace.Write("6");
+ Fubar();
+ }
+ finally
+ {
+ _trace.Write("9");
+ }
+ }
+
+ void Fubar()
+ {
+ try
+ {
+ _trace.Write("7");
+ throw new ExType1();
+ }
+ finally
+ {
+ _trace.Write("8");
+ }
+ }
+}
+
diff --git a/tests/src/baseservices/exceptions/unittests/CollidedUnwind.csproj b/tests/src/baseservices/exceptions/unittests/CollidedUnwind.csproj
new file mode 100644
index 0000000000..c091cbc406
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/CollidedUnwind.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CollidedUnwind.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/EHPatternTests.cs b/tests/src/baseservices/exceptions/unittests/EHPatternTests.cs
new file mode 100644
index 0000000000..756569e6a2
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/EHPatternTests.cs
@@ -0,0 +1,1434 @@
+// 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;
+
+//
+// infrastructure
+//
+public class Trace
+{
+ public Trace(string tag, string expected)
+ {
+ Console.WriteLine("-----------------------------");
+ Console.WriteLine(tag);
+ Console.WriteLine("-----------------------------");
+ _expected = expected;
+ }
+
+ public void Write(string str)
+ {
+ _actual += str;
+ // Console.Write(str);
+ }
+
+ public void WriteLine(string str)
+ {
+ _actual += str;
+ _actual += Environment.NewLine;
+
+ // Console.WriteLine(str);
+ }
+
+ public int Match()
+ {
+ // Console.WriteLine("");
+ Console.Write(_expected);
+ if (_actual.Equals(_expected))
+ {
+ Console.WriteLine(": PASS");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine(": FAIL: _actual='" + _actual + "'");
+ Console.WriteLine("_expected='" + _expected + "'");
+ return 999;
+ }
+ }
+
+ string _actual;
+ string _expected;
+}
+
+//
+// main
+//
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ // @TODO: SDM: // CountResults(new StackOverflowInLeafFunction().Run(), ref nSuccesses, ref nFailures);
+
+ CountResults(new BaseClassTest().Run(), ref nSuccesses, ref nFailures);
+ CountResults(new TryCatchInFinallyTest().Run(), ref nSuccesses, ref nFailures);
+ CountResults(new RecurseTest().Run(), ref nSuccesses, ref nFailures);
+ CountResults(new ThrowInFinallyNestedInTryTest().Run(), ref nSuccesses, ref nFailures); // FAIL: needs skip to parent code <TODO> investigate </TODO>
+ CountResults(new GoryManagedPresentTest().Run(), ref nSuccesses, ref nFailures); // FAIL: needs skip to parent code <TODO> investigate </TODO>
+ CountResults(new InnerFinallyAndCatchTest().Run(), ref nSuccesses, ref nFailures);
+ CountResults(new InnerFinallyTest().Run(), ref nSuccesses, ref nFailures);
+ CountResults(new ThrowInFinallyTest().Run(), ref nSuccesses, ref nFailures);
+ CountResults(new RecursiveRethrow().Run(), ref nSuccesses, ref nFailures);
+ CountResults(new RecursiveThrowNew().Run(), ref nSuccesses, ref nFailures);
+ CountResults(new PendingTest().Run(), ref nSuccesses, ref nFailures);
+ CountResults(new CollidedUnwindTest().Run(), ref nSuccesses, ref nFailures);
+ CountResults(new BaadbaadTest().Run(), ref nSuccesses, ref nFailures);
+ CountResults(new GoryNativePastTest().Run(), ref nSuccesses, ref nFailures);
+ CountResults(new ThrowInCatchTest().Run(), ref nSuccesses, ref nFailures);
+ CountResults(new StrSwitchFinalTest().Run(), ref nSuccesses, ref nFailures);
+ CountResults(new RethrowAndFinallysTest().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+//
+// tests
+//
+
+public class RecursiveRethrow
+{
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("RecursiveRethrow", "210C0C1C2");
+
+ try
+ {
+ LoveToRecurse(2);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e);
+ }
+
+ return _trace.Match();
+ }
+
+
+ void SeparatorMethod(int i)
+ {
+ LoveToRecurse(i);
+ }
+
+ void LoveToRecurse(int i)
+ {
+ try
+ {
+ _trace.Write(i.ToString());
+ if (0 == i)
+ {
+ throw new Exception("RecursionIsFun");
+ }
+ else
+ {
+ SeparatorMethod(i - 1);
+ }
+ }
+ catch (Exception e)
+ {
+ _trace.Write("C" + i.ToString());
+ Console.WriteLine(e);
+ throw e;
+ }
+ }
+}
+
+public class RecursiveThrowNew
+{
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("RecursiveThrowNew", "210C0(eX)C1(e0)C2(e1)CM(e2)");
+
+ try
+ {
+ LoveToRecurse(2);
+ }
+ catch (Exception e)
+ {
+ _trace.Write("CM(" + e.Message + ")");
+ Console.WriteLine(e);
+ }
+
+ return _trace.Match();
+ }
+
+
+ void SeparatorMethod(int i)
+ {
+ LoveToRecurse(i);
+ }
+
+ void LoveToRecurse(int i)
+ {
+ try
+ {
+ _trace.Write(i.ToString());
+ if (0 == i)
+ {
+ throw new Exception("eX");
+ }
+ else
+ {
+ SeparatorMethod(i - 1);
+ }
+ }
+ catch (Exception e)
+ {
+ _trace.Write("C" + i.ToString() + "(" + e.Message + ")");
+ Console.WriteLine(e);
+ throw new Exception("e" + i.ToString());
+ }
+ }
+}
+
+
+public class BaadbaadTest
+{
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("BaadbaadTest", "1234");
+
+ try
+ {
+ DoStuff();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("4");
+ }
+ return _trace.Match();
+ }
+
+ void DoStuff()
+ {
+ try
+ {
+ try
+ {
+ try
+ {
+ throw new Exception();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("1");
+ throw;
+ }
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("2");
+ throw;
+ }
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("3");
+ throw;
+ }
+ }
+}
+
+
+class BaseClassTest
+{
+ Trace _trace;
+
+ void f2()
+ {
+ throw new FileNotFoundException("1");
+ }
+
+ void f1()
+ {
+ try
+ {
+ f2();
+ }
+ catch(FileNotFoundException e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("0" + e.Message);
+ throw e;
+ }
+ catch(IOException e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("!" + e.Message);
+ throw e;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("@" + e.Message);
+ throw e;
+ }
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("BaseClassTest", "0121");
+
+ try
+ {
+ f1();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("2" + e.Message);
+ }
+
+ return _trace.Match();
+ }
+}
+
+
+
+public class CollidedUnwindTest
+{
+ class ExType1 : Exception
+ {
+ }
+
+ class ExType2 : Exception
+ {
+ }
+
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("CollidedUnwindTest", "0123456789ABCDE");
+
+ try
+ {
+ _trace.Write("0");
+ Foo();
+ }
+ catch (ExType2 e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("E");
+ }
+
+ return _trace.Match();
+ }
+
+ void Foo()
+ {
+ try
+ {
+ _trace.Write("1");
+ FnAAA();
+ }
+ catch (ExType1 e)
+ {
+ Console.WriteLine(e);
+ _trace.Write(" BAD ");
+ }
+ }
+
+ void FnAAA()
+ {
+ try
+ {
+ _trace.Write("2");
+ FnBBB();
+ }
+ finally
+ {
+ _trace.Write("D");
+ }
+ }
+
+ void FnBBB()
+ {
+ try
+ {
+ _trace.Write("3");
+ Bar();
+ }
+ finally
+ {
+ _trace.Write("C");
+ }
+ }
+
+ void Bar()
+ {
+ try
+ {
+ _trace.Write("4");
+ FnCCC();
+ }
+ finally
+ {
+ _trace.Write("B");
+ throw new ExType2();
+ }
+ }
+
+ void FnCCC()
+ {
+ try
+ {
+ _trace.Write("5");
+ FnDDD();
+ }
+ finally
+ {
+ _trace.Write("A");
+ }
+ }
+
+ void FnDDD()
+ {
+ try
+ {
+ _trace.Write("6");
+ Fubar();
+ }
+ finally
+ {
+ _trace.Write("9");
+ }
+ }
+
+ void Fubar()
+ {
+ try
+ {
+ _trace.Write("7");
+ throw new ExType1();
+ }
+ finally
+ {
+ _trace.Write("8");
+ }
+ }
+}
+
+public class ThrowInFinallyNestedInTryTest
+{
+ Trace _trace;
+
+ void MiddleMethod()
+ {
+ _trace.Write("2");
+ try
+ {
+ _trace.Write("3");
+ try
+ {
+ _trace.Write("4");
+ }
+ finally
+ {
+ _trace.Write("5");
+ try
+ {
+ _trace.Write("6");
+ throw new System.ArgumentException();
+ }
+ finally
+ {
+ _trace.Write("7");
+ }
+ }
+ }
+ finally
+ {
+ _trace.Write("8");
+ }
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("ThrowInFinallyNestedInTryTest", "0123456789a");
+
+ _trace.Write("0");
+ try
+ {
+ _trace.Write("1");
+ MiddleMethod();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("9");
+ }
+ _trace.Write("a");
+
+ return _trace.Match();
+ }
+}
+
+class ThrowInFinallyTest
+{
+ Trace _trace;
+
+ void Dumb()
+ {
+ _trace.Write("2");
+ try
+ {
+ _trace.Write("3");
+ try
+ {
+ _trace.Write("4");
+ try
+ {
+ _trace.Write("5");
+ throw new Exception("A");
+ }
+ finally
+ {
+ _trace.Write("6");
+ throw new Exception("B");
+ }
+ }
+ finally
+ {
+ _trace.Write("7");
+ throw new Exception("C");
+ }
+ }
+ finally
+ {
+ _trace.Write("8");
+ }
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("ThrowInFinallyTest", "0123456789Ca");
+
+ _trace.Write("0");
+ try
+ {
+ _trace.Write("1");
+ Dumb();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("9");
+ _trace.Write(e.Message);
+ }
+ _trace.Write("a");
+ return _trace.Match();
+ }
+}
+
+class ThrowInCatchTest
+{
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("ThrowInCatchTest", "0123456");
+ _trace.Write("0");
+ try
+ {
+ _trace.Write("1");
+ try
+ {
+ _trace.Write("2");
+ throw new Exception(".....");
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("3");
+ throw new Exception("5");
+ }
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("4");
+ _trace.Write(e.Message);
+ }
+ _trace.Write("6");
+ return _trace.Match();
+ }
+}
+
+class RecurseTest
+{
+ Trace _trace;
+
+ void DoTest(int level)
+ {
+ _trace.Write(level.ToString());
+ if (level <= 0)
+ return;
+
+ try
+ {
+ throw new Exception("" + (level - 1));
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write(e.Message);
+ DoTest(level - 2);
+ }
+ }
+
+ public int Run()
+ {
+ int n = 8;
+ string expected = "";
+
+ // create expected result string
+ for (int i = n; i >= 0; i--)
+ {
+ expected += i.ToString();
+ }
+
+ _trace = new Trace("RecurseTest", expected);
+
+ DoTest(n);
+
+ return _trace.Match();
+ }
+}
+
+class PendingTest
+{
+ Trace _trace;
+
+ void f3()
+ {
+ throw new Exception();
+ }
+
+ void f2()
+ {
+ try
+ {
+ _trace.Write("1");
+ f3();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("2");
+ throw;
+ }
+ }
+
+ void f1()
+ {
+ try
+ {
+ _trace.Write("0");
+ f2();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("3");
+ throw e;
+ }
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("PendingTest", "0123401235");
+
+ try
+ {
+ f1();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("4");
+ }
+
+ try
+ {
+ f1();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("5");
+ }
+
+ return _trace.Match();
+ }
+}
+
+
+class GoryNativePastTest
+{
+ Trace _trace;
+
+ void bar()
+ {
+ _trace.Write("2");
+ throw new Exception("6");
+ }
+
+ void foo()
+ {
+ _trace.Write("1");
+ try
+ {
+ bar();
+ }
+ finally
+ {
+ _trace.Write("3");
+ }
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("GoryNativePastTest", "0123456");
+
+ _trace.Write("0");
+ try
+ {
+ try
+ {
+ foo();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("4");
+ throw;
+ }
+ }
+ catch(Exception e)
+ {
+ _trace.Write("5");
+ _trace.Write(e.Message);
+ }
+ return _trace.Match();
+ }
+}
+
+class GoryManagedPresentTest
+{
+ Trace _trace;
+
+ void foo(int dummy)
+ {
+ _trace.Write("1");
+ try
+ {
+ _trace.Write("2");
+ try
+ {
+ _trace.Write("3");
+ if (1234 == dummy)
+ {
+ goto MyLabel;
+ }
+ _trace.Write("....");
+ }
+ finally
+ {
+ _trace.Write("4");
+ }
+ }
+ finally
+ {
+ _trace.Write("5");
+ if (1234 == dummy)
+ {
+ int i = 0;
+ int q = 167 / i;
+ }
+ }
+
+ _trace.Write("****");
+
+ MyLabel:
+ _trace.Write("~~~~");
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("GoryManagedPresentTest", "0123456");
+ try
+ {
+ _trace.Write("0");
+ foo(1234);
+ _trace.Write("%%%%");
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("6");
+ }
+
+ return _trace.Match();
+ }
+}
+
+class TryCatchInFinallyTest
+{
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("TryCatchInFinallyTest", "0123456");
+
+ _trace.Write("0");
+ try
+ {
+ _trace.Write("1");
+ }
+ finally
+ {
+ _trace.Write("2");
+ try
+ {
+ _trace.Write("3");
+ throw new InvalidProgramException();
+ }
+ catch(InvalidProgramException e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("4");
+ }
+ _trace.Write("5");
+ }
+ _trace.Write("6");
+
+ return _trace.Match();
+ }
+}
+
+class StrSwitchFinalTest
+{
+ Trace _trace;
+ static string _expected;
+
+ static StrSwitchFinalTest()
+ {
+ // Create test writer object to hold expected output
+ System.IO.StringWriter expectedOut = new System.IO.StringWriter();
+
+ // Write expected output to string writer object
+ expectedOut.WriteLine("s == one");
+ expectedOut.WriteLine("In inner finally");
+ expectedOut.WriteLine("In outer finally\r\n");
+ expectedOut.WriteLine("s == two");
+ expectedOut.WriteLine("After two");
+ expectedOut.WriteLine("In inner finally");
+ expectedOut.WriteLine("In outer finally\r\n");
+ expectedOut.WriteLine("s == three");
+ expectedOut.WriteLine("After three");
+ expectedOut.WriteLine("Ok");
+ expectedOut.WriteLine("After after three");
+ expectedOut.WriteLine("In inner finally");
+ expectedOut.WriteLine("Caught an exception\r\n");
+ expectedOut.WriteLine("Ok\r\n");
+ expectedOut.WriteLine("In outer finally\r\n");
+
+ expectedOut.WriteLine("In four's finally");
+ expectedOut.WriteLine("In inner finally");
+ expectedOut.WriteLine("Caught an exception\r\n");
+
+ expectedOut.WriteLine("Ok\r\n");
+
+ expectedOut.WriteLine("In outer finally\r\n");
+
+ expectedOut.WriteLine("s == five");
+ expectedOut.WriteLine("Five's finally 0");
+ expectedOut.WriteLine("Five's finally 1");
+ expectedOut.WriteLine("Five's finally 2");
+ expectedOut.WriteLine("In inner finally");
+ expectedOut.WriteLine("In outer finally\r\n");
+
+ expectedOut.WriteLine("Greater than five");
+ expectedOut.WriteLine("in six's finally");
+ expectedOut.WriteLine("In inner finally");
+ expectedOut.WriteLine("In outer finally\r\n");
+
+ _expected = expectedOut.ToString();
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("StrSwitchFinalTest", _expected);
+
+ string[] s = {"one", "two", "three", "four", "five", "six"};
+
+ for(int i = 0; i < s.Length; i++)
+ {
+
+ beginloop:
+ try
+ {
+ try
+ {
+ try
+ {
+ switch(s[i])
+ {
+ case "one":
+ try
+ {
+ _trace.WriteLine("s == one");
+ }
+ catch
+ {
+ _trace.WriteLine("Exception at one");
+ }
+ break;
+ case "two":
+ try
+ {
+ _trace.WriteLine("s == two");
+ }
+ finally
+ {
+ _trace.WriteLine("After two");
+ }
+ break;
+ case "three":
+ try
+ {
+ try
+ {
+ _trace.WriteLine("s == three");
+ }
+ catch(System.Exception e)
+ {
+ _trace.WriteLine(e.ToString());
+ goto continueloop;
+ }
+ }
+ finally
+ {
+ _trace.WriteLine("After three");
+ try
+ {
+ switch(s[s.Length-1])
+ {
+ case "six":
+ _trace.WriteLine("Ok");
+ _trace.WriteLine(s[s.Length]);
+ goto label2;
+ default:
+ try
+ {
+ _trace.WriteLine("Ack");
+ goto label;
+ }
+ catch
+ {
+ _trace.WriteLine("I don't think so ...");
+ }
+ break;
+ }
+ label:
+ _trace.WriteLine("Unreached");
+ throw new Exception();
+ }
+ finally
+ {
+ _trace.WriteLine("After after three");
+ }
+ label2:
+ _trace.WriteLine("Unreached");
+
+ }
+ goto continueloop;
+
+ case "four":
+ try
+ {
+ try
+ {
+ _trace.WriteLine("s == " + s[s.Length]);
+ try
+ {
+ }
+ finally
+ {
+ _trace.WriteLine("Unreached");
+ }
+ }
+ catch (Exception e)
+ {
+ goto test;
+ rethrowex:
+ throw;
+ test:
+ if (e is System.ArithmeticException)
+ {
+
+ try
+ {
+ _trace.WriteLine("unreached ");
+ goto finishfour;
+ }
+ finally
+ {
+ _trace.WriteLine("also unreached");
+ }
+ }
+ else
+ {
+ goto rethrowex;
+ }
+ }
+ }
+ finally
+ {
+ _trace.WriteLine("In four's finally");
+ }
+ finishfour:
+ break;
+ case "five":
+ try
+ {
+ try
+ {
+ try
+ {
+
+ _trace.WriteLine("s == five");
+ }
+ finally
+ {
+ _trace.WriteLine("Five's finally 0");
+ }
+ }
+ catch (Exception)
+ {
+ _trace.WriteLine("Unreached");
+ }
+ finally
+ {
+ _trace.WriteLine("Five's finally 1");
+ }
+ break;
+ }
+ finally
+ {
+ _trace.WriteLine("Five's finally 2");
+ }
+ default:
+ try
+ {
+ _trace.WriteLine("Greater than five");
+ goto finish;
+ }
+ finally
+ {
+ _trace.WriteLine("in six's finally");
+
+ }
+
+ };
+ continue;
+ }
+ finally
+ {
+ _trace.WriteLine("In inner finally");
+ }
+ }
+ catch (Exception e)
+ {
+ _trace.WriteLine("Caught an exception\r\n");
+
+ switch(s[i])
+ {
+ case "three":
+ if (e is System.IndexOutOfRangeException)
+ {
+ _trace.WriteLine("Ok\r\n");
+ i++;
+ goto beginloop;
+ }
+ _trace.WriteLine("Unreached\r\n");
+ break;
+ case "four":
+ if (e is System.IndexOutOfRangeException)
+ {
+ _trace.WriteLine("Ok\r\n");
+ i++;
+ goto beginloop;
+ }
+ _trace.WriteLine("Unreached\r\n");
+ break;
+ default:
+ _trace.WriteLine("****** Unreached");
+ goto continueloop;
+ }
+
+ }
+
+ _trace.WriteLine("Unreached");
+ }
+ finally
+ {
+ _trace.WriteLine("In outer finally\r\n");
+ }
+
+ continueloop:
+ _trace.WriteLine("Continuing");
+
+ }
+ finish:
+
+ return _trace.Match();;
+ }
+}
+
+
+public class RethrowAndFinallysTest
+{
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("RethrowAndFinallysTest", "abcdefF3ED2CB1A[done]");
+ try
+ {
+ _trace.Write("a");
+ try
+ {
+ _trace.Write("b");
+ try
+ {
+ _trace.Write("c");
+ try
+ {
+ _trace.Write("d");
+ try
+ {
+ _trace.Write("e");
+ try
+ {
+ _trace.Write("f");
+ throw new Exception("ex1");
+ }
+ finally
+ {
+ _trace.Write("F");
+ }
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("3");
+ throw;
+ }
+ finally
+ {
+ _trace.Write("E");
+ }
+ }
+ finally
+ {
+ _trace.Write("D");
+ }
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("2");
+ throw;
+ }
+ finally
+ {
+ _trace.Write("C");
+ }
+ }
+ finally
+ {
+ _trace.Write("B");
+ }
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("1");
+ }
+ finally
+ {
+ _trace.Write("A");
+ }
+
+ _trace.Write("[done]");
+
+ return _trace.Match();
+ }
+}
+
+
+
+class InnerFinallyTest
+{
+ Trace _trace;
+
+ public InnerFinallyTest()
+ {
+ // Create test writer object to hold expected output
+ System.IO.StringWriter expectedOut = new System.IO.StringWriter();
+
+ // Write expected output to string writer object
+ expectedOut.WriteLine(" try 1");
+ expectedOut.WriteLine("\t try 1.1");
+ expectedOut.WriteLine("\t finally 1.1");
+ expectedOut.WriteLine("\t\t try 1.1.1");
+ expectedOut.WriteLine("\t\t Throwing an exception here!");
+ expectedOut.WriteLine("\t\t finally 1.1.1");
+ expectedOut.WriteLine(" catch 1");
+ expectedOut.WriteLine(" finally 1");
+
+ _trace = new Trace("InnerFinallyTest", expectedOut.ToString());
+ }
+
+ public int Run()
+ {
+ int x = 7, y = 0, z;
+
+ try
+ {
+ _trace.WriteLine(" try 1");
+ try
+ {
+ _trace.WriteLine("\t try 1.1");
+ }
+ finally
+ {
+ _trace.WriteLine("\t finally 1.1");
+ try
+ {
+ _trace.WriteLine("\t\t try 1.1.1");
+ _trace.WriteLine("\t\t Throwing an exception here!");
+ z = x / y;
+ }
+ finally
+ {
+ _trace.WriteLine("\t\t finally 1.1.1");
+ }
+ }
+ }
+ catch (Exception)
+ {
+ _trace.WriteLine(" catch 1");
+ }
+ finally
+ {
+ _trace.WriteLine(" finally 1");
+ }
+
+ return _trace.Match();
+ }
+}
+
+
+class InnerFinallyAndCatchTest
+{
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("InnerFinallyAndCatchTest", "abcdefghijklm13");
+
+ int x = 7, y = 0, z;
+
+ int count = 0;
+
+ try
+ {
+ _trace.Write("a");
+ count++;
+ try
+ {
+ _trace.Write("b");
+ count++;
+ }
+ finally // 1
+ {
+ try
+ {
+ _trace.Write("c");
+ count++;
+ }
+ finally // 2
+ {
+ try
+ {
+ try
+ {
+ _trace.Write("d");
+ count++;
+ }
+ finally // 3
+ {
+ _trace.Write("e");
+ count++;
+ try
+ {
+ _trace.Write("f");
+ count++;
+ }
+ finally // 4
+ {
+ _trace.Write("g");
+ count++;
+ z = x / y;
+ }
+ _trace.Write("@@");
+ count++;
+ }
+ }
+ catch (Exception) // C2
+ {
+ _trace.Write("h");
+ count++;
+ }
+ _trace.Write("i");
+ count++;
+ }
+ _trace.Write("j");
+ count++;
+ }
+ _trace.Write("k");
+ count++;
+ }
+ catch (Exception) // C1
+ {
+ _trace.Write("!!");
+ count++;
+ }
+ finally // 0
+ {
+ _trace.Write("l");
+ count++;
+ }
+
+ _trace.Write("m");
+ count++;
+
+ _trace.Write(count.ToString());
+
+ return _trace.Match();
+ }
+}
+
+
+class StackOverflowInLeafFunction
+{
+ Trace _trace;
+
+/*
+ int LeafFunction(int a, int b)
+ {
+ int c;
+
+ try
+ {
+ // raise stack overflow
+ }
+ catch
+ {
+ c = b / a; // this exception will not be able to dispatch
+ }
+
+ return c;
+ }
+*/
+
+ unsafe void RecursiveDeath(int depth)
+ {
+ string msg = String.Concat("caught at depth:", depth.ToString());
+ long* pStuff = stackalloc long[128];
+
+ for (int i = 0; i < 128; i++)
+ {
+ short d = (short)depth;
+ long dd = (long)d;
+
+ long foo = dd << 48;
+ foo |= dd << 32;
+ foo |= dd << 16;
+ foo |= dd;
+
+ pStuff[i] = foo;
+ }
+
+ try
+ {
+ RecursiveDeath(depth + 1);
+ }
+ catch
+ {
+ Console.WriteLine(msg);
+ }
+
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("", "123");
+
+ _trace.Write("1");
+
+ try
+ {
+ RecursiveDeath(0);
+ }
+ catch
+ {
+ _trace.Write("2");
+ }
+
+ _trace.Write("3");
+
+ return _trace.Match();
+ }
+}
+
diff --git a/tests/src/baseservices/exceptions/unittests/EHPatternTests.csproj b/tests/src/baseservices/exceptions/unittests/EHPatternTests.csproj
new file mode 100644
index 0000000000..673def16ee
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/EHPatternTests.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EHPatternTests.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/GoryManagedPresent.cs b/tests/src/baseservices/exceptions/unittests/GoryManagedPresent.cs
new file mode 100644
index 0000000000..485d1167e3
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/GoryManagedPresent.cs
@@ -0,0 +1,100 @@
+// 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;
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new GoryManagedPresentTest().Run(), ref nSuccesses, ref nFailures); // FAIL: needs skip to parent code <TODO> investigate </TODO>
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+class GoryManagedPresentTest
+{
+ Trace _trace;
+
+ void foo(int dummy)
+ {
+ _trace.Write("1");
+ try
+ {
+ _trace.Write("2");
+ try
+ {
+ _trace.Write("3");
+ if (1234 == dummy)
+ {
+ goto MyLabel;
+ }
+ _trace.Write("....");
+ }
+ finally
+ {
+ _trace.Write("4");
+ }
+ }
+ finally
+ {
+ _trace.Write("5");
+ if (1234 == dummy)
+ {
+ int i = 0;
+ int q = 167 / i;
+ }
+ }
+
+ _trace.Write("****");
+
+ MyLabel:
+ _trace.Write("~~~~");
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("GoryManagedPresentTest", "0123456");
+ try
+ {
+ _trace.Write("0");
+ foo(1234);
+ _trace.Write("%%%%");
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("6");
+ }
+
+ return _trace.Match();
+ }
+}
+
diff --git a/tests/src/baseservices/exceptions/unittests/GoryManagedPresent.csproj b/tests/src/baseservices/exceptions/unittests/GoryManagedPresent.csproj
new file mode 100644
index 0000000000..097b335e59
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/GoryManagedPresent.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="GoryManagedPresent.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/GoryNativePast.cs b/tests/src/baseservices/exceptions/unittests/GoryNativePast.cs
new file mode 100644
index 0000000000..777d1c7ed6
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/GoryNativePast.cs
@@ -0,0 +1,91 @@
+// 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;
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new GoryNativePastTest().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+class GoryNativePastTest
+{
+ Trace _trace;
+
+ void bar()
+ {
+ _trace.Write("2");
+ throw new Exception("6");
+ }
+
+ void foo()
+ {
+ _trace.Write("1");
+ try
+ {
+ bar();
+ }
+ finally
+ {
+ _trace.Write("3");
+ }
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("GoryNativePastTest", "0123456");
+
+ _trace.Write("0");
+ try
+ {
+ try
+ {
+ foo();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("4");
+ throw;
+ }
+ }
+ catch(Exception e)
+ {
+ _trace.Write("5");
+ _trace.Write(e.Message);
+ }
+ return _trace.Match();
+ }
+}
+
diff --git a/tests/src/baseservices/exceptions/unittests/GoryNativePast.csproj b/tests/src/baseservices/exceptions/unittests/GoryNativePast.csproj
new file mode 100644
index 0000000000..c4c389be95
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/GoryNativePast.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="GoryNativePast.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/InnerFinally.csproj b/tests/src/baseservices/exceptions/unittests/InnerFinally.csproj
new file mode 100644
index 0000000000..fe340da307
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/InnerFinally.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="innerfinally.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/InnerFinallyAndCatch.cs b/tests/src/baseservices/exceptions/unittests/InnerFinallyAndCatch.cs
new file mode 100644
index 0000000000..74abe712bc
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/InnerFinallyAndCatch.cs
@@ -0,0 +1,131 @@
+// 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;
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new InnerFinallyAndCatchTest().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+class InnerFinallyAndCatchTest
+{
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("InnerFinallyAndCatchTest", "abcdefghijklm13");
+
+ int x = 7, y = 0, z;
+
+ int count = 0;
+
+ try
+ {
+ _trace.Write("a");
+ count++;
+ try
+ {
+ _trace.Write("b");
+ count++;
+ }
+ finally // 1
+ {
+ try
+ {
+ _trace.Write("c");
+ count++;
+ }
+ finally // 2
+ {
+ try
+ {
+ try
+ {
+ _trace.Write("d");
+ count++;
+ }
+ finally // 3
+ {
+ _trace.Write("e");
+ count++;
+ try
+ {
+ _trace.Write("f");
+ count++;
+ }
+ finally // 4
+ {
+ _trace.Write("g");
+ count++;
+ z = x / y;
+ }
+ _trace.Write("@@");
+ count++;
+ }
+ }
+ catch (Exception) // C2
+ {
+ _trace.Write("h");
+ count++;
+ }
+ _trace.Write("i");
+ count++;
+ }
+ _trace.Write("j");
+ count++;
+ }
+ _trace.Write("k");
+ count++;
+ }
+ catch (Exception) // C1
+ {
+ _trace.Write("!!");
+ count++;
+ }
+ finally // 0
+ {
+ _trace.Write("l");
+ count++;
+ }
+
+ _trace.Write("m");
+ count++;
+
+ _trace.Write(count.ToString());
+
+ return _trace.Match();
+ }
+}
+
diff --git a/tests/src/baseservices/exceptions/unittests/InnerFinallyAndCatch.csproj b/tests/src/baseservices/exceptions/unittests/InnerFinallyAndCatch.csproj
new file mode 100644
index 0000000000..5ba52747c4
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/InnerFinallyAndCatch.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="InnerFinallyAndCatch.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/Pending.cs b/tests/src/baseservices/exceptions/unittests/Pending.cs
new file mode 100644
index 0000000000..5307bb078c
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/Pending.cs
@@ -0,0 +1,111 @@
+// 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;
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new PendingTest().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+
+class PendingTest
+{
+ Trace _trace;
+
+ void f3()
+ {
+ throw new Exception();
+ }
+
+ void f2()
+ {
+ try
+ {
+ _trace.Write("1");
+ f3();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("2");
+ throw;
+ }
+ }
+
+ void f1()
+ {
+ try
+ {
+ _trace.Write("0");
+ f2();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("3");
+ throw e;
+ }
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("PendingTest", "0123401235");
+
+ try
+ {
+ f1();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("4");
+ }
+
+ try
+ {
+ f1();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("5");
+ }
+
+ return _trace.Match();
+ }
+}
+
+
+
diff --git a/tests/src/baseservices/exceptions/unittests/Pending.csproj b/tests/src/baseservices/exceptions/unittests/Pending.csproj
new file mode 100644
index 0000000000..cfa278e347
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/Pending.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="Pending.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/Recurse.cs b/tests/src/baseservices/exceptions/unittests/Recurse.cs
new file mode 100644
index 0000000000..0c4579ba0c
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/Recurse.cs
@@ -0,0 +1,82 @@
+// 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;
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new RecurseTest().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+class RecurseTest
+{
+ Trace _trace;
+
+ void DoTest(int level)
+ {
+ _trace.Write(level.ToString());
+ if (level <= 0)
+ return;
+
+ try
+ {
+ throw new Exception("" + (level - 1));
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write(e.Message);
+ DoTest(level - 2);
+ }
+ }
+
+ public int Run()
+ {
+ int n = 8;
+ string expected = "";
+
+ // create expected result string
+ for (int i = n; i >= 0; i--)
+ {
+ expected += i.ToString();
+ }
+
+ _trace = new Trace("RecurseTest", expected);
+
+ DoTest(n);
+
+ return _trace.Match();
+ }
+}
+
diff --git a/tests/src/baseservices/exceptions/unittests/Recurse.csproj b/tests/src/baseservices/exceptions/unittests/Recurse.csproj
new file mode 100644
index 0000000000..f9e30c5e7f
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/Recurse.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="Recurse.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/RecursiveRethrow.cs b/tests/src/baseservices/exceptions/unittests/RecursiveRethrow.cs
new file mode 100644
index 0000000000..5ceb3710f3
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/RecursiveRethrow.cs
@@ -0,0 +1,91 @@
+// 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;
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new RecursiveRethrow().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+public class RecursiveRethrow
+{
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("RecursiveRethrow", "210C0C1C2RecursionIsFun");
+
+ try
+ {
+ LoveToRecurse(2);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write(e.Message);
+ }
+
+ return _trace.Match();
+ }
+
+
+ void SeparatorMethod(int i)
+ {
+ LoveToRecurse(i);
+ }
+
+ void LoveToRecurse(int i)
+ {
+ try
+ {
+ _trace.Write(i.ToString());
+ if (0 == i)
+ {
+ throw new Exception("RecursionIsFun");
+ }
+ else
+ {
+ SeparatorMethod(i - 1);
+ }
+ }
+ catch (Exception e)
+ {
+ _trace.Write("C" + i.ToString());
+ Console.WriteLine(e);
+ throw e;
+ }
+ }
+}
+
diff --git a/tests/src/baseservices/exceptions/unittests/RecursiveRethrow.csproj b/tests/src/baseservices/exceptions/unittests/RecursiveRethrow.csproj
new file mode 100644
index 0000000000..357f150e08
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/RecursiveRethrow.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="RecursiveRethrow.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/RecursiveThrowNew.cs b/tests/src/baseservices/exceptions/unittests/RecursiveThrowNew.cs
new file mode 100644
index 0000000000..b4ae467c5c
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/RecursiveThrowNew.cs
@@ -0,0 +1,92 @@
+// 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;
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new RecursiveThrowNew().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+public class RecursiveThrowNew
+{
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("RecursiveThrowNew", "210C0(eX)C1(e0)C2(e1)CM(e2)");
+
+ try
+ {
+ LoveToRecurse(2);
+ }
+ catch (Exception e)
+ {
+ _trace.Write("CM(" + e.Message + ")");
+ Console.WriteLine(e);
+ }
+
+ return _trace.Match();
+ }
+
+
+ void SeparatorMethod(int i)
+ {
+ LoveToRecurse(i);
+ }
+
+ void LoveToRecurse(int i)
+ {
+ try
+ {
+ _trace.Write(i.ToString());
+ if (0 == i)
+ {
+ throw new Exception("eX");
+ }
+ else
+ {
+ SeparatorMethod(i - 1);
+ }
+ }
+ catch (Exception e)
+ {
+ _trace.Write("C" + i.ToString() + "(" + e.Message + ")");
+ Console.WriteLine(e);
+ throw new Exception("e" + i.ToString());
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/exceptions/unittests/RecursiveThrowNew.csproj b/tests/src/baseservices/exceptions/unittests/RecursiveThrowNew.csproj
new file mode 100644
index 0000000000..40c62b6942
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/RecursiveThrowNew.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="RecursiveThrowNew.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/RethrowAndFinally.csproj b/tests/src/baseservices/exceptions/unittests/RethrowAndFinally.csproj
new file mode 100644
index 0000000000..06a09500ab
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/RethrowAndFinally.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="rethrowandfinally.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/ReturnFromCatch.csproj b/tests/src/baseservices/exceptions/unittests/ReturnFromCatch.csproj
new file mode 100644
index 0000000000..1effe2a6c6
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/ReturnFromCatch.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="returnfromcatch.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/StrSwitchFinally.cs b/tests/src/baseservices/exceptions/unittests/StrSwitchFinally.cs
new file mode 100644
index 0000000000..d84e8293ef
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/StrSwitchFinally.cs
@@ -0,0 +1,326 @@
+// 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;
+
+//
+// main
+//
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new StrSwitchFinalTest().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+class StrSwitchFinalTest
+{
+ Trace _trace;
+ static string _expected;
+
+ static StrSwitchFinalTest()
+ {
+ // Create test writer object to hold expected output
+ System.IO.StringWriter expectedOut = new System.IO.StringWriter();
+
+ // Write expected output to string writer object
+ expectedOut.WriteLine("s == one");
+ expectedOut.WriteLine("In inner finally");
+ expectedOut.WriteLine("In outer finally\r\n");
+ expectedOut.WriteLine("s == two");
+ expectedOut.WriteLine("After two");
+ expectedOut.WriteLine("In inner finally");
+ expectedOut.WriteLine("In outer finally\r\n");
+ expectedOut.WriteLine("s == three");
+ expectedOut.WriteLine("After three");
+ expectedOut.WriteLine("Ok");
+ expectedOut.WriteLine("After after three");
+ expectedOut.WriteLine("In inner finally");
+ expectedOut.WriteLine("Caught an exception\r\n");
+ expectedOut.WriteLine("Ok\r\n");
+ expectedOut.WriteLine("In outer finally\r\n");
+
+ expectedOut.WriteLine("In four's finally");
+ expectedOut.WriteLine("In inner finally");
+ expectedOut.WriteLine("Caught an exception\r\n");
+
+ expectedOut.WriteLine("Ok\r\n");
+
+ expectedOut.WriteLine("In outer finally\r\n");
+
+ expectedOut.WriteLine("s == five");
+ expectedOut.WriteLine("Five's finally 0");
+ expectedOut.WriteLine("Five's finally 1");
+ expectedOut.WriteLine("Five's finally 2");
+ expectedOut.WriteLine("In inner finally");
+ expectedOut.WriteLine("In outer finally\r\n");
+
+ expectedOut.WriteLine("Greater than five");
+ expectedOut.WriteLine("in six's finally");
+ expectedOut.WriteLine("In inner finally");
+ expectedOut.WriteLine("In outer finally\r\n");
+
+ _expected = expectedOut.ToString();
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("StrSwitchFinalTest", _expected);
+
+ string[] s = {"one", "two", "three", "four", "five", "six"};
+
+ for(int i = 0; i < s.Length; i++)
+ {
+
+ beginloop:
+ try
+ {
+ try
+ {
+ try
+ {
+ switch(s[i])
+ {
+ case "one":
+ try
+ {
+ _trace.WriteLine("s == one");
+ }
+ catch
+ {
+ _trace.WriteLine("Exception at one");
+ }
+ break;
+ case "two":
+ try
+ {
+ _trace.WriteLine("s == two");
+ }
+ finally
+ {
+ _trace.WriteLine("After two");
+ }
+ break;
+ case "three":
+ try
+ {
+ try
+ {
+ _trace.WriteLine("s == three");
+ }
+ catch(System.Exception e)
+ {
+ _trace.WriteLine(e.ToString());
+ goto continueloop;
+ }
+ }
+ finally
+ {
+ _trace.WriteLine("After three");
+ try
+ {
+ switch(s[s.Length-1])
+ {
+ case "six":
+ _trace.WriteLine("Ok");
+ _trace.WriteLine(s[s.Length]);
+ goto label2;
+ default:
+ try
+ {
+ _trace.WriteLine("Ack");
+ goto label;
+ }
+ catch
+ {
+ _trace.WriteLine("I don't think so ...");
+ }
+ break;
+ }
+ label:
+ _trace.WriteLine("Unreached");
+ throw new Exception();
+ }
+ finally
+ {
+ _trace.WriteLine("After after three");
+ }
+ label2:
+ _trace.WriteLine("Unreached");
+
+ }
+ goto continueloop;
+
+ case "four":
+ try
+ {
+ try
+ {
+ _trace.WriteLine("s == " + s[s.Length]);
+ try
+ {
+ }
+ finally
+ {
+ _trace.WriteLine("Unreached");
+ }
+ }
+ catch (Exception e)
+ {
+ goto test;
+ rethrowex:
+ throw;
+ test:
+ if (e is System.ArithmeticException)
+ {
+
+ try
+ {
+ _trace.WriteLine("unreached ");
+ goto finishfour;
+ }
+ finally
+ {
+ _trace.WriteLine("also unreached");
+ }
+ }
+ else
+ {
+ goto rethrowex;
+ }
+ }
+ }
+ finally
+ {
+ _trace.WriteLine("In four's finally");
+ }
+ finishfour:
+ break;
+ case "five":
+ try
+ {
+ try
+ {
+ try
+ {
+
+ _trace.WriteLine("s == five");
+ }
+ finally
+ {
+ _trace.WriteLine("Five's finally 0");
+ }
+ }
+ catch (Exception)
+ {
+ _trace.WriteLine("Unreached");
+ }
+ finally
+ {
+ _trace.WriteLine("Five's finally 1");
+ }
+ break;
+ }
+ finally
+ {
+ _trace.WriteLine("Five's finally 2");
+ }
+ default:
+ try
+ {
+ _trace.WriteLine("Greater than five");
+ goto finish;
+ }
+ finally
+ {
+ _trace.WriteLine("in six's finally");
+
+ }
+
+ };
+ continue;
+ }
+ finally
+ {
+ _trace.WriteLine("In inner finally");
+ }
+ }
+ catch (Exception e)
+ {
+ _trace.WriteLine("Caught an exception\r\n");
+
+ switch(s[i])
+ {
+ case "three":
+ if (e is System.IndexOutOfRangeException)
+ {
+ _trace.WriteLine("Ok\r\n");
+ i++;
+ goto beginloop;
+ }
+ _trace.WriteLine("Unreached\r\n");
+ break;
+ case "four":
+ if (e is System.IndexOutOfRangeException)
+ {
+ _trace.WriteLine("Ok\r\n");
+ i++;
+ goto beginloop;
+ }
+ _trace.WriteLine("Unreached\r\n");
+ break;
+ default:
+ _trace.WriteLine("****** Unreached");
+ goto continueloop;
+ }
+
+ }
+
+ _trace.WriteLine("Unreached");
+ }
+ finally
+ {
+ _trace.WriteLine("In outer finally\r\n");
+ }
+
+ continueloop:
+ _trace.WriteLine("Continuing");
+
+ }
+ finish:
+
+ return _trace.Match();;
+ }
+}
+
+
diff --git a/tests/src/baseservices/exceptions/unittests/StrSwitchFinally.csproj b/tests/src/baseservices/exceptions/unittests/StrSwitchFinally.csproj
new file mode 100644
index 0000000000..135f78923e
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/StrSwitchFinally.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="StrSwitchFinally.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/ThrowInCatch.csproj b/tests/src/baseservices/exceptions/unittests/ThrowInCatch.csproj
new file mode 100644
index 0000000000..88e342cff3
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/ThrowInCatch.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="throwincatch.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/ThrowInFinally.csproj b/tests/src/baseservices/exceptions/unittests/ThrowInFinally.csproj
new file mode 100644
index 0000000000..2a0d1344a8
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/ThrowInFinally.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="throwinfinally.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/ThrowInFinallyNestedInTry.cs b/tests/src/baseservices/exceptions/unittests/ThrowInFinallyNestedInTry.cs
new file mode 100644
index 0000000000..fda491caa0
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/ThrowInFinallyNestedInTry.cs
@@ -0,0 +1,101 @@
+// 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;
+
+//
+// main
+//
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new ThrowInFinallyNestedInTryTest().Run(), ref nSuccesses, ref nFailures); // FAIL: needs skip to parent code <TODO> investigate </TODO>
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+public class ThrowInFinallyNestedInTryTest
+{
+ Trace _trace;
+
+ void MiddleMethod()
+ {
+ _trace.Write("2");
+ try
+ {
+ _trace.Write("3");
+ try
+ {
+ _trace.Write("4");
+ }
+ finally
+ {
+ _trace.Write("5");
+ try
+ {
+ _trace.Write("6");
+ throw new System.ArgumentException();
+ }
+ finally
+ {
+ _trace.Write("7");
+ }
+ }
+ }
+ finally
+ {
+ _trace.Write("8");
+ }
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("ThrowInFinallyNestedInTryTest", "0123456789a");
+
+ _trace.Write("0");
+ try
+ {
+ _trace.Write("1");
+ MiddleMethod();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("9");
+ }
+ _trace.Write("a");
+
+ return _trace.Match();
+ }
+}
+
+
diff --git a/tests/src/baseservices/exceptions/unittests/ThrowInFinallyNestedInTry.csproj b/tests/src/baseservices/exceptions/unittests/ThrowInFinallyNestedInTry.csproj
new file mode 100644
index 0000000000..7fb28cbf7b
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/ThrowInFinallyNestedInTry.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ThrowInFinallyNestedInTry.cs" />
+ <Compile Include="trace.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/TryCatchInFinally.csproj b/tests/src/baseservices/exceptions/unittests/TryCatchInFinally.csproj
new file mode 100644
index 0000000000..24d7e4acce
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/TryCatchInFinally.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="trace.cs" />
+ <Compile Include="trycatchinfinally.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/unittests/baseclass.cs b/tests/src/baseservices/exceptions/unittests/baseclass.cs
new file mode 100644
index 0000000000..b34e1f133f
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/baseclass.cs
@@ -0,0 +1,99 @@
+// 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;
+
+//
+// main
+//
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new BaseClassTest().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+class BaseClassTest
+{
+ Trace _trace;
+
+ void f2()
+ {
+ throw new FileNotFoundException("1");
+ }
+
+ void f1()
+ {
+ try
+ {
+ f2();
+ }
+ catch(FileNotFoundException e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("0" + e.Message);
+ throw e;
+ }
+ catch(IOException e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("!" + e.Message);
+ throw e;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("@" + e.Message);
+ throw e;
+ }
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("BaseClassTest", "0121");
+
+ try
+ {
+ f1();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("2" + e.Message);
+ }
+
+ return _trace.Match();
+ }
+}
+
+
+
diff --git a/tests/src/baseservices/exceptions/unittests/innerfinally.cs b/tests/src/baseservices/exceptions/unittests/innerfinally.cs
new file mode 100644
index 0000000000..bbffa2b637
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/innerfinally.cs
@@ -0,0 +1,102 @@
+// 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;
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new InnerFinallyTest().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+class InnerFinallyTest
+{
+ Trace _trace;
+
+ public InnerFinallyTest()
+ {
+ // Create test writer object to hold expected output
+ System.IO.StringWriter expectedOut = new System.IO.StringWriter();
+
+ // Write expected output to string writer object
+ expectedOut.WriteLine(" try 1");
+ expectedOut.WriteLine("\t try 1.1");
+ expectedOut.WriteLine("\t finally 1.1");
+ expectedOut.WriteLine("\t\t try 1.1.1");
+ expectedOut.WriteLine("\t\t Throwing an exception here!");
+ expectedOut.WriteLine("\t\t finally 1.1.1");
+ expectedOut.WriteLine(" catch 1");
+ expectedOut.WriteLine(" finally 1");
+
+ _trace = new Trace("InnerFinallyTest", expectedOut.ToString());
+ }
+
+ public int Run()
+ {
+ int x = 7, y = 0, z;
+
+ try
+ {
+ _trace.WriteLine(" try 1");
+ try
+ {
+ _trace.WriteLine("\t try 1.1");
+ }
+ finally
+ {
+ _trace.WriteLine("\t finally 1.1");
+ try
+ {
+ _trace.WriteLine("\t\t try 1.1.1");
+ _trace.WriteLine("\t\t Throwing an exception here!");
+ z = x / y;
+ }
+ finally
+ {
+ _trace.WriteLine("\t\t finally 1.1.1");
+ }
+ }
+ }
+ catch (Exception)
+ {
+ _trace.WriteLine(" catch 1");
+ }
+ finally
+ {
+ _trace.WriteLine(" finally 1");
+ }
+
+ return _trace.Match();
+ }
+}
+
+
diff --git a/tests/src/baseservices/exceptions/unittests/rethrowandfinally.cs b/tests/src/baseservices/exceptions/unittests/rethrowandfinally.cs
new file mode 100644
index 0000000000..fdd9ea299f
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/rethrowandfinally.cs
@@ -0,0 +1,125 @@
+// 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;
+
+//
+// main
+//
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new RethrowAndFinallysTest().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+public class RethrowAndFinallysTest
+{
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("RethrowAndFinallysTest", "abcdefF3ED2CB1A[done]");
+ try
+ {
+ _trace.Write("a");
+ try
+ {
+ _trace.Write("b");
+ try
+ {
+ _trace.Write("c");
+ try
+ {
+ _trace.Write("d");
+ try
+ {
+ _trace.Write("e");
+ try
+ {
+ _trace.Write("f");
+ throw new Exception("ex1");
+ }
+ finally
+ {
+ _trace.Write("F");
+ }
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("3");
+ throw;
+ }
+ finally
+ {
+ _trace.Write("E");
+ }
+ }
+ finally
+ {
+ _trace.Write("D");
+ }
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("2");
+ throw;
+ }
+ finally
+ {
+ _trace.Write("C");
+ }
+ }
+ finally
+ {
+ _trace.Write("B");
+ }
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("1");
+ }
+ finally
+ {
+ _trace.Write("A");
+ }
+
+ _trace.Write("[done]");
+
+ return _trace.Match();
+ }
+}
+
+
diff --git a/tests/src/baseservices/exceptions/unittests/returnfromcatch.cs b/tests/src/baseservices/exceptions/unittests/returnfromcatch.cs
new file mode 100644
index 0000000000..26ca1903a0
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/returnfromcatch.cs
@@ -0,0 +1,57 @@
+// 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;
+
+public class TestSet
+{
+
+ public static int Main()
+ {
+ int retCode = (new ReturnFromCatchTest()).Run();
+ if (100 == retCode)
+ {
+ Console.WriteLine("Test Passed");
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ }
+ return retCode;
+ }
+}
+
+class ReturnFromCatchTest
+{
+ public int Run()
+ {
+ int henry = 0;
+
+ DoNotInlineMethod(ref henry);
+
+ return henry;
+ }
+
+ private void DoNotInlineMethod(ref int bob)
+ {
+ try
+ {
+ Console.WriteLine("Inside Try. Setting return code to 50");
+ bob = 50;
+
+ }
+ catch(Exception)
+ {
+ Console.WriteLine("Inside Catch. Setting return code to 25");
+ Console.WriteLine("Next line returns so Finally in this method should be next and it will set return code to 100;");
+ bob = 25;
+ return;
+ }
+ finally
+ {
+ Console.WriteLine("Finally running. This is expected.");
+ bob = 100;
+ }
+ }
+}
+
diff --git a/tests/src/baseservices/exceptions/unittests/throwincatch.cs b/tests/src/baseservices/exceptions/unittests/throwincatch.cs
new file mode 100644
index 0000000000..f253bdebca
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/throwincatch.cs
@@ -0,0 +1,79 @@
+// 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;
+
+//
+// main
+//
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new ThrowInCatchTest().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+class ThrowInCatchTest
+{
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("ThrowInCatchTest", "0123456");
+ _trace.Write("0");
+ try
+ {
+ _trace.Write("1");
+ try
+ {
+ _trace.Write("2");
+ throw new Exception(".....");
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("3");
+ throw new Exception("5");
+ }
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("4");
+ _trace.Write(e.Message);
+ }
+ _trace.Write("6");
+ return _trace.Match();
+ }
+}
+
+
diff --git a/tests/src/baseservices/exceptions/unittests/throwinfinally.cs b/tests/src/baseservices/exceptions/unittests/throwinfinally.cs
new file mode 100644
index 0000000000..ef12db83eb
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/throwinfinally.cs
@@ -0,0 +1,101 @@
+// 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;
+
+//
+// main
+//
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new ThrowInFinallyTest().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+
+class ThrowInFinallyTest
+{
+ Trace _trace;
+
+ void Dumb()
+ {
+ _trace.Write("2");
+ try
+ {
+ _trace.Write("3");
+ try
+ {
+ _trace.Write("4");
+ try
+ {
+ _trace.Write("5");
+ throw new Exception("A");
+ }
+ finally
+ {
+ _trace.Write("6");
+ throw new Exception("B");
+ }
+ }
+ finally
+ {
+ _trace.Write("7");
+ throw new Exception("C");
+ }
+ }
+ finally
+ {
+ _trace.Write("8");
+ }
+ }
+
+ public int Run()
+ {
+ _trace = new Trace("ThrowInFinallyTest", "0123456789Ca");
+
+ _trace.Write("0");
+ try
+ {
+ _trace.Write("1");
+ Dumb();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("9");
+ _trace.Write(e.Message);
+ }
+ _trace.Write("a");
+ return _trace.Match();
+ }
+}
diff --git a/tests/src/baseservices/exceptions/unittests/trace.cs b/tests/src/baseservices/exceptions/unittests/trace.cs
new file mode 100644
index 0000000000..1f16402e36
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/trace.cs
@@ -0,0 +1,55 @@
+// 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 TestLibrary;
+
+//
+// infrastructure
+//
+public class Trace
+{
+ public Trace(string tag, string expected)
+ {
+ Console.WriteLine("-----------------------------");
+ Console.WriteLine(tag);
+ Console.WriteLine("-----------------------------");
+ _expected = expected;
+ }
+
+ public void Write(string str)
+ {
+ _actual += str;
+ // Console.Write(str);
+ }
+
+ public void WriteLine(string str)
+ {
+ _actual += str;
+ _actual += Environment.NewLine;
+
+ // Console.WriteLine(str);
+ }
+
+ public int Match()
+ {
+ // Console.WriteLine("");
+ Console.Write(_expected);
+ if (_actual.Equals(_expected))
+ {
+ Console.WriteLine(": PASS");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine(": FAIL: _actual='" + _actual + "'");
+ Console.WriteLine("_expected='" + _expected + "'");
+ return 999;
+ }
+ }
+
+ string _actual;
+ string _expected;
+}
+
diff --git a/tests/src/baseservices/exceptions/unittests/trycatchinfinally.cs b/tests/src/baseservices/exceptions/unittests/trycatchinfinally.cs
new file mode 100644
index 0000000000..5228e8ea0d
--- /dev/null
+++ b/tests/src/baseservices/exceptions/unittests/trycatchinfinally.cs
@@ -0,0 +1,77 @@
+// 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;
+
+//
+// main
+//
+
+public class TestSet
+{
+ static void CountResults(int testReturnValue, ref int nSuccesses, ref int nFailures)
+ {
+ if (100 == testReturnValue)
+ {
+ nSuccesses++;
+ }
+ else
+ {
+ nFailures++;
+ }
+ }
+
+ public static int Main()
+ {
+ int nSuccesses = 0;
+ int nFailures = 0;
+
+ CountResults(new TryCatchInFinallyTest().Run(), ref nSuccesses, ref nFailures);
+
+ if (0 == nFailures)
+ {
+ Console.WriteLine("OVERALL PASS: " + nSuccesses + " tests");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("OVERALL FAIL: " + nFailures + " tests failed");
+ return 999;
+ }
+ }
+}
+
+class TryCatchInFinallyTest
+{
+ Trace _trace;
+
+ public int Run()
+ {
+ _trace = new Trace("TryCatchInFinallyTest", "0123456");
+
+ _trace.Write("0");
+ try
+ {
+ _trace.Write("1");
+ }
+ finally
+ {
+ _trace.Write("2");
+ try
+ {
+ _trace.Write("3");
+ throw new InvalidProgramException();
+ }
+ catch(InvalidProgramException e)
+ {
+ Console.WriteLine(e);
+ _trace.Write("4");
+ }
+ _trace.Write("5");
+ }
+ _trace.Write("6");
+
+ return _trace.Match();
+ }
+}
diff --git a/tests/src/baseservices/finalization/Finalizer.csproj b/tests/src/baseservices/finalization/Finalizer.csproj
new file mode 100644
index 0000000000..47acddeb0b
--- /dev/null
+++ b/tests/src/baseservices/finalization/Finalizer.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="finalizer.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/finalization/FinalizerSigned.csproj b/tests/src/baseservices/finalization/FinalizerSigned.csproj
new file mode 100644
index 0000000000..47acddeb0b
--- /dev/null
+++ b/tests/src/baseservices/finalization/FinalizerSigned.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="finalizer.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/finalization/finalizer.cs b/tests/src/baseservices/finalization/finalizer.cs
new file mode 100644
index 0000000000..65dfe4fe2e
--- /dev/null
+++ b/tests/src/baseservices/finalization/finalizer.cs
@@ -0,0 +1,193 @@
+// 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;
+
+/*
+public interface IFinalize
+{
+ ~IFinalize();
+}
+
+public class Finalize : IFinalize
+{
+ ~Finalize(){ Console.WriteLine("IFinalize");}
+}
+*/
+//Test cases:
+// Finalizers can not have a protection level (i.e Pubic, Protected, internal, protected internal, private)
+// Types in namespace can only be public or internal
+// Negative:
+// Must do checks with reflection as types are scanned at assembly load time resulting in AssemblyLoad failures
+// Public class with finalizer
+// internal class with finalizer
+// Class with finalizer in Abstract base classes
+// Wrapper classes with child classes with finalizers
+// protected, protected internal, private
+// Positive:
+// Platform types with finalizers
+// Non platform type that derives from abstract platform with finalizer
+// Variations:
+// Reflection load
+// Startup class
+// Attributes?
+
+public class Finalizer
+{
+ public Finalizer() { }
+ ~Finalizer() { Console.WriteLine("In Finalizer"); }
+}
+
+public class FinalizerWrapperProtected
+{
+ public FinalizerWrapperProtected()
+ {
+ FinalizerProtected fp = new FinalizerProtected();
+ }
+
+ protected class FinalizerProtected
+ {
+ public FinalizerProtected() { }
+ ~FinalizerProtected() { Console.WriteLine("In FinalizerProtected"); }
+ }
+}
+
+internal class FinalizerInternal
+{
+ public FinalizerInternal() { }
+ ~FinalizerInternal() { Console.WriteLine("In FinalizerInternal"); }
+}
+
+public class FinalizerWrapperProtectedInternal
+{
+ public FinalizerWrapperProtectedInternal()
+ {
+ FinalizerProtectedInternal fp = new FinalizerProtectedInternal();
+ }
+
+ protected internal class FinalizerProtectedInternal
+ {
+ public FinalizerProtectedInternal() { }
+ ~FinalizerProtectedInternal() { Console.WriteLine("In FinalizerProtectedInternal"); }
+ }
+}
+public class FinalizerWrapperPrivate
+{
+ public FinalizerWrapperPrivate()
+ {
+ FinalizerPrivate fp = new FinalizerPrivate();
+ }
+ private class FinalizerPrivate
+ {
+ public FinalizerPrivate() { }
+ ~FinalizerPrivate() { Console.WriteLine("In FinalizerProtectedInternal"); }
+ }
+}
+
+public abstract class FinalizerBase
+{
+ public FinalizerBase() { }
+ ~FinalizerBase() { Console.WriteLine("In FinalizerBase"); }
+}
+
+public class FinalizerAbstract : FinalizerBase
+{
+ public FinalizerAbstract() { }
+}
+
+public class FinalizerGeneric<T>
+{
+ public FinalizerGeneric(){}
+ ~FinalizerGeneric(){}
+}
+
+public class FinalizerWrapperGeneric
+{
+ public FinalizerWrapperGeneric()
+ {
+ FinalizerPrivate<int> fp = new FinalizerPrivate<int>();
+ }
+
+ private class FinalizerPrivate<T>
+ {
+ public FinalizerPrivate() { }
+ ~FinalizerPrivate() { }
+ }
+}
+
+public class Gen<T>
+{
+ public Gen() { }
+}
+
+#if STATIC
+public class Test
+{
+ public static int Main()
+ {
+ return (new Test()).RunTest();
+ }
+
+ private int RunTest()
+ {
+ try
+ {
+ RunFinalizer();
+ RunFinalizerWrapperProtected();
+ RunFinalizerInternal();
+ RunFinalizerWrapperProtectedInternal();
+ RunFinalizerWrapperPrivate();
+ RunFinalizerAbstract();
+ RunFinalizerGeneric();
+ RunFinalizerWrapperGeneric();
+ RunGeneric();
+
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("ERROR - Caught unexpected exception");
+ Console.WriteLine(e);
+ return 1;
+ }
+ Console.WriteLine("Test PASSED");
+ return 100;
+ }
+
+ private void RunFinalizer()
+ {
+ Finalizer f = new Finalizer();
+ }
+ private void RunFinalizerWrapperProtected()
+ {
+ FinalizerWrapperProtected f = new FinalizerWrapperProtected();
+ }
+ private void RunFinalizerInternal()
+ {
+ FinalizerInternal f = new FinalizerInternal();
+ }
+ private void RunFinalizerWrapperProtectedInternal()
+ {
+ FinalizerWrapperProtectedInternal f = new FinalizerWrapperProtectedInternal();
+ }
+ private void RunFinalizerWrapperPrivate()
+ {
+ FinalizerWrapperPrivate f = new FinalizerWrapperPrivate();
+ }
+ private void RunFinalizerAbstract()
+ {
+ FinalizerAbstract f = new FinalizerAbstract();
+ }
+ private void RunFinalizerGeneric()
+ {
+ FinalizerGeneric<int> f = new FinalizerGeneric<int>();
+ }
+ private void RunFinalizerWrapperGeneric()
+ {
+ FinalizerWrapperGeneric f = new FinalizerWrapperGeneric();
+ }
+ private void RunGeneric()
+ {
+ Gen<Finalizer> gen = new Gen<Finalizer>();
+ }
+}
+#endif
diff --git a/tests/src/baseservices/ilasm_ildasm/regression/dd130885/xlib.cs b/tests/src/baseservices/ilasm_ildasm/regression/dd130885/xlib.cs
new file mode 100644
index 0000000000..8b00a2664a
--- /dev/null
+++ b/tests/src/baseservices/ilasm_ildasm/regression/dd130885/xlib.cs
@@ -0,0 +1,24 @@
+// 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;
+public struct myDateTime : IEquatable<myDateTime>
+{
+ public UInt64 dateData;
+ public override string ToString()
+ {
+ return "myDateTime";
+ }
+ public bool Equals(myDateTime d)
+ {
+ return dateData == d.dateData;
+ }
+ public void InstanceMethod()
+ {
+ Console.WriteLine("InstanceMethod");
+ }
+ public void GenericMethod<T>()
+ {
+ Console.WriteLine(typeof(T));
+ }
+}
diff --git a/tests/src/baseservices/ilasm_ildasm/regression/dd130885/xlib.csproj b/tests/src/baseservices/ilasm_ildasm/regression/dd130885/xlib.csproj
new file mode 100644
index 0000000000..7bd9c3af4c
--- /dev/null
+++ b/tests/src/baseservices/ilasm_ildasm/regression/dd130885/xlib.csproj
@@ -0,0 +1,47 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="xlib.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <ItemGroup>
+ <NoWarn Include="42016,42020,42025,42024" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey267905/267905.cs b/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey267905/267905.cs
new file mode 100644
index 0000000000..2b964a1c0c
--- /dev/null
+++ b/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey267905/267905.cs
@@ -0,0 +1,14 @@
+// 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.Collections;
+using System.Collections.Generic;
+
+public class Test
+{
+ public static void Eval<T>(string s, string y, params object[] arg)
+ {
+ Console.WriteLine("Hello!");
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey267905/267905.csproj b/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey267905/267905.csproj
new file mode 100644
index 0000000000..ead8fb9550
--- /dev/null
+++ b/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey267905/267905.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="267905.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey305155/305155.cs b/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey305155/305155.cs
new file mode 100644
index 0000000000..459f6f302a
--- /dev/null
+++ b/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey305155/305155.cs
@@ -0,0 +1,16 @@
+// 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;
+
+[AttributeUsage(AttributeTargets.Method)]
+public class MyAttribute : Attribute
+{
+ public Type[] Types;
+}
+
+public class Test
+{
+ [MyAttribute(Types = new Type[]{typeof(string), typeof(void)})]
+ public static int Main(String[] args) { return 0; }
+}
diff --git a/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey305155/305155.csproj b/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey305155/305155.csproj
new file mode 100644
index 0000000000..0575fa9d9d
--- /dev/null
+++ b/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey305155/305155.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="305155.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey395914/395914.cs b/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey395914/395914.cs
new file mode 100644
index 0000000000..516981ac31
--- /dev/null
+++ b/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey395914/395914.cs
@@ -0,0 +1,9 @@
+// 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;
+
+public class C {
+ public void F<T>() where T : class, new() { }
+ public void G<T>() where T : struct { }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey395914/395914.csproj b/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey395914/395914.csproj
new file mode 100644
index 0000000000..95fb8649f2
--- /dev/null
+++ b/tests/src/baseservices/ilasm_ildasm/regression/vswhidbey395914/395914.csproj
@@ -0,0 +1,47 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="395914.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <ItemGroup>
+ <NoWarn Include="42016,42020,42025,42024" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/multidimmarray/enum.cs b/tests/src/baseservices/multidimmarray/enum.cs
new file mode 100644
index 0000000000..a344a5414d
--- /dev/null
+++ b/tests/src/baseservices/multidimmarray/enum.cs
@@ -0,0 +1,26 @@
+using System;
+
+public class Test
+{
+ enum State : sbyte { OK = 0, BUG = -1 }
+ static int Main(string[] args)
+ {
+ TestLibrary.TestFramework.BeginTestCase("Enum MultidimmArray");
+ var s = new State[1, 1];
+ s[0, 0] = State.BUG;
+ State a = s[0, 0];
+ if(a == s[0, 0])
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/multidimmarray/enum.csproj b/tests/src/baseservices/multidimmarray/enum.csproj
new file mode 100644
index 0000000000..3a1f4675b6
--- /dev/null
+++ b/tests/src/baseservices/multidimmarray/enum.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="enum.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/regression/v1/assembly/vos/cool/helloworld/First.csproj b/tests/src/baseservices/regression/v1/assembly/vos/cool/helloworld/First.csproj
new file mode 100644
index 0000000000..dedbc847eb
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/assembly/vos/cool/helloworld/First.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="first.cool" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/regression/v1/assembly/vos/cool/helloworld/first.cool b/tests/src/baseservices/regression/v1/assembly/vos/cool/helloworld/first.cool
new file mode 100644
index 0000000000..eb2ee6ebf0
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/assembly/vos/cool/helloworld/first.cool
@@ -0,0 +1,31 @@
+using System;
+
+namespace OneMore
+{
+
+ public class B{
+ public static void methodinB(){
+ Console.WriteLine("You reached b");
+ }
+ }
+}
+
+
+
+namespace NumeroUno{
+
+ using System;
+
+ public class A{
+
+ public static int Main(String[] args){
+ Console.WriteLine("Hello World");
+ OneMore.B b = new OneMore.B();
+ OneMore.B.methodinB();
+
+ return 100;
+
+ }
+ }
+
+}
diff --git a/tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/Assembly1.csproj b/tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/Assembly1.csproj
new file mode 100644
index 0000000000..e8c77862cd
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/Assembly1.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="assembly1.cool" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/assembly1.cool b/tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/assembly1.cool
new file mode 100644
index 0000000000..aaee02c8b5
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/assembly1.cool
@@ -0,0 +1,70 @@
+using System;
+
+
+public interface IM2Dll
+{
+ int IM2Dll_1();
+};
+
+public interface IM2Dll2
+{
+ // Statics
+
+
+ // Interface methods.
+ int IM2Dll2_1();
+};
+
+
+public class M2Dll : IM2Dll
+{
+ public static int iDllConst1 = 1; // A field
+ public static int iDllConst2 = 2; // A static field.
+ public static int iDllConst3 = 3;
+ int m_iDllVar0 = 0;
+
+ public static int DumpStatics(){
+ Console.WriteLine(iDllConst1);
+ Console.WriteLine(iDllConst2);
+ return (iDllConst2);
+ }
+
+ public int DumpMembers()
+ {
+ return (m_iDllVar0);
+ }
+
+ public int DllVirtual()
+ {
+ return (1);
+ }
+
+ // IM2Dll_1 methods.
+ public int IM2Dll_1()
+ {
+ return (101);
+ }
+
+
+};
+
+public interface IM2Super1
+{
+
+ // Interface methods.
+ int IM2Super1_1();
+ int IM2Super1_2();
+ int IM2Super();
+};
+
+public interface IM2Super2
+{
+ // Interface methods.
+ int IM2Super2_1();
+};
+
+public interface IM2Bar: IM2Super1, IM2Super2
+{
+ // Interface methods.
+ int IM2Bar_1();
+};
diff --git a/tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/assembly2.cool b/tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/assembly2.cool
new file mode 100644
index 0000000000..1953401264
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/assembly2.cool
@@ -0,0 +1,154 @@
+using System;
+
+// Main test base class, inherits from class in another Dll
+public abstract class M2Base : M2Dll, IM2Bar
+{
+ public static int iConst3 = -3; // Interface constant.
+ public static int iConst4 = 4; // Base class constant.
+ public static int iConst5 = 5;
+
+ // Member variables.
+ internal int m_iVar0;
+ internal int m_iVar1;
+ internal int m_iVar2 = 0;
+
+ // Construction
+ public M2Base()
+ {
+ }
+
+ public M2Base(int i) // M2Dll constructor should be called.
+ {
+ m_iVar0 = i;
+ m_iVar1 = iDllConst1;
+ }
+
+
+ // Member functions.
+ public abstract int BaseVirtual(); // Test abstract base class.
+ public abstract int IM2Super1_2();
+
+ // IM6Bar methods.
+ public int IM2Super1_1()
+ {
+ return (201);
+ }
+ public int IM2Super2_1()
+ {
+ return (202);
+ }
+ public int IM2Bar_1()
+ {
+ return (203);
+ }
+ public int IM2Super() // Implements two interface methods.
+ {
+ return (204);
+ }
+};
+
+public interface IM2Foo
+{
+ // Static interface fields.
+ // Interface methods.
+ int IM2Foo_1();
+ int IM2Foo_1(int i);
+};
+
+// Main test class.
+public class M2Exe : M2Base, IM2Foo , IM2Dll2
+{
+ // Statics
+ static int iConst1 = 1; // Interface constant.
+ static int iConst2 = iConst1 + 1; // Transitive constant.
+ static new int iConst3 = iConst1 + 2; // Ditto
+ static int iDllConst4 = 4;
+ static int iConst6 = 0; // Class constant.
+ static int iConst7 = 0; // Inheritance from interface.
+ // static int iConst1 ; // Override.
+
+ // Member variables.
+ int m_iVar3;
+
+ public M2Exe(){
+ m_iVar3 = M2Exe.iConst3;
+ }
+ // Construction
+ public M2Exe(int i): base(i-999) // super(i-999);
+ {
+ m_iVar3 = M2Exe.iConst3; // Member variable using explicit scope.
+ }
+
+ // Class methods.
+ static new int DumpStatics()
+ {
+ Console.WriteLine(iConst1);
+ Console.WriteLine(M2Exe.iConst1);
+ Console.WriteLine(iConst2);
+ Console.WriteLine(M2Exe.iConst3);
+ Console.WriteLine(M2Exe.iConst3);
+ Console.WriteLine(iConst4);
+ Console.WriteLine(iConst5);
+ Console.WriteLine(iConst6);
+ Console.WriteLine(iConst7);
+ M2Dll.DumpStatics();
+ Console.WriteLine(iDllConst4);
+ return (1);
+ }
+
+ // Member functions.
+ public int DumpMembers1()
+ {
+ Console.WriteLine(m_iVar0);
+ Console.WriteLine(m_iVar1);
+ Console.WriteLine(m_iVar2);
+ Console.WriteLine(m_iVar3);
+ DumpMembers();
+ return (m_iVar1 + m_iVar3);
+ }
+
+//BUG: Assert Failure if a function is overloaded
+ public new int DllVirtual()
+ {
+// TODO call the base function
+ return (((M2Base)this).DllVirtual()); // Inherited from M6Dll
+ }
+
+
+ public override int BaseVirtual()
+ {
+ return (50);
+ }
+ public int ExeVirtual()
+ {
+ return (51);
+ }
+ public override int IM2Super1_2() // Used to implement method of IBar's interface.
+ {
+ return (52);
+ }
+
+ public int IM2Foo_1()
+ {
+ return (80);
+ }
+
+ // IM6Foo methods.
+ public int IM2Foo_1(int i)
+ {
+ return (i);
+ }
+
+
+ // IM2Dll2 methods.
+ public int IM2Dll2_1()
+ {
+ return (81);
+ }
+};
+
+
+
+
+
+
diff --git a/tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/assembly3.cool b/tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/assembly3.cool
new file mode 100644
index 0000000000..81ccc3818d
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/assembly/vos/cool/multipleassembly/assembly3.cool
@@ -0,0 +1,23 @@
+
+public class M2Base2 : M2Dll
+{
+ // Statics
+ static int iIgnoreMe = Base2_1();
+
+ // Construction
+ public M2Base2() // Should implicitly call base ctor.
+ {
+ }
+
+ // Class methods.
+ static int Base2_1()
+ {
+ return (0);
+ }
+
+ // IM2Dll_1 method overrides.
+ public new int IM2Dll_1()
+ {
+ return (300);
+ }
+};
diff --git a/tests/src/baseservices/regression/v1/seh/vc/chain/ManagedDll.csproj b/tests/src/baseservices/regression/v1/seh/vc/chain/ManagedDll.csproj
new file mode 100644
index 0000000000..e6e569caaa
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/seh/vc/chain/ManagedDll.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="manageddll.cool" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/regression/v1/seh/vc/chain/manageddll.cool b/tests/src/baseservices/regression/v1/seh/vc/chain/manageddll.cool
new file mode 100644
index 0000000000..b873199669
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/seh/vc/chain/manageddll.cool
@@ -0,0 +1,7 @@
+
+
+public class ManagedDll {
+
+[System.Runtime.InteropServices.DllImport("unmanaged.dll")]
+ public static extern void UnmanagedCode( int i) ;
+} \ No newline at end of file
diff --git a/tests/src/baseservices/regression/v1/threads/functional/thread/TcultureDLL.csproj b/tests/src/baseservices/regression/v1/threads/functional/thread/TcultureDLL.csproj
new file mode 100644
index 0000000000..cc37677bef
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/threads/functional/thread/TcultureDLL.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="tculturedll.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/regression/v1/threads/functional/thread/tculturedll.cs b/tests/src/baseservices/regression/v1/threads/functional/thread/tculturedll.cs
new file mode 100644
index 0000000000..a5dd393f99
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/threads/functional/thread/tculturedll.cs
@@ -0,0 +1,246 @@
+// 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;
+
+namespace TCulture
+{
+
+ /// <summary>
+ /// Culture: A specific culture
+ /// Note: On cultures with a true for Valid can be set to a thread
+ /// The true value is specifing the language as culture specific
+ /// </summary>
+ class Culture
+ {
+ private string strCultureName;
+ private int intCultureID;
+ private string strLanguage;
+ private bool bValid;
+
+ public Culture(string CN, int ID, string L, bool V)
+ {
+ strCultureName = CN;
+ intCultureID = Convert.ToInt32(ID);
+ strLanguage = L;
+ bValid = V;
+ }
+
+ public string CultureName(){ return strCultureName; }
+ public string Language(){ return strLanguage; }
+ public int CultureID(){ return intCultureID; }
+ public bool Valid(){ return bValid; }
+ }
+
+
+ public class CultureNames
+ {
+ private Culture[] cultures;
+ public CultureNames()
+ {
+ CN_Setup();
+ }
+
+ public int GetLength(){ return cultures.Length; }
+ public string GetName(int i){ return cultures[i].CultureName(); }
+ public string GetLanguage(int i){ return cultures[i].Language(); }
+ public int GetID(int i){ return cultures[i].CultureID(); }
+ public bool Valid(int i){ return cultures[i].Valid(); }
+
+ private void CN_Setup()
+ {
+ cultures = new Culture[191];
+ cultures[0] = new Culture("",0x007F,"invariant culture",true);
+ cultures[1] = new Culture("af",0x0036,"Afrikaans",true);
+ cultures[2] = new Culture("af-ZA",0x0436,"Afrikaans - South Africa",true);
+ cultures[3] = new Culture("sq",0x001C,"Albanian",true);
+ cultures[4] = new Culture("sq-AL",0x041C,"Albanian - Albania",true);
+ cultures[5] = new Culture("ar",0x0001,"Arabic",true);
+ cultures[6] = new Culture("ar-DZ",0x1401,"Arabic - Algeria",true);
+ cultures[7] = new Culture("ar-BH",0x3C01,"Arabic - Bahrain",true);
+ cultures[8] = new Culture("ar-EG",0x0C01,"Arabic - Egypt",true);
+ cultures[9] = new Culture("ar-IQ",0x0801,"Arabic - Iraq",true);
+ cultures[10] = new Culture("ar-JO",0x2C01,"Arabic - Jordan",true);
+ cultures[11] = new Culture("ar-KW",0x3401,"Arabic - Kuwait",true);
+ cultures[12] = new Culture("ar-LB",0x3001,"Arabic - Lebanon",true);
+ cultures[13] = new Culture("ar-LY",0x1001,"Arabic - Libya",true);
+ cultures[14] = new Culture("ar-MA",0x1801,"Arabic - Morocco",true);
+ cultures[15] = new Culture("ar-OM",0x2001,"Arabic - Oman",true);
+ cultures[16] = new Culture("ar-QA",0x4001,"Arabic - Qatar",true);
+ cultures[17] = new Culture("ar-SA",0x0401,"Arabic - Saudi Arabia",true);
+ cultures[18] = new Culture("ar-SY",0x2801,"Arabic - Syria",true);
+ cultures[19] = new Culture("ar-TN",0x1C01,"Arabic - Tunisia",true);
+ cultures[20] = new Culture("ar-AE",0x3801,"Arabic - United Arab Emirates",true);
+ cultures[21] = new Culture("ar-YE",0x2401,"Arabic - Yemen",true);
+ cultures[22] = new Culture("hy",0x002B,"Armenian",true);
+ cultures[23] = new Culture("hy-AM",0x042B,"Armenian - Armenia",true);
+ cultures[24] = new Culture("az",0x002C,"Azeri",true);
+ cultures[25] = new Culture("az-Cyrl-AZ",0x082C,"Azeri (Cyrillic) - Azerbaijan",true);
+ cultures[26] = new Culture("az-Latn-AZ",0x042C,"Azeri (Latin) - Azerbaijan",true);
+ cultures[27] = new Culture("eu",0x002D,"Basque",true);
+ cultures[28] = new Culture("eu-ES",0x042D,"Basque - Basque",true);
+ cultures[29] = new Culture("be",0x0023,"Belarusian",true);
+ cultures[30] = new Culture("be-BY",0x0423,"Belarusian - Belarus",true);
+ cultures[31] = new Culture("bg",0x0002,"Bulgarian",true);
+ cultures[32] = new Culture("bg-BG",0x0402,"Bulgarian - Bulgaria",true);
+ cultures[33] = new Culture("ca",0x0003,"Catalan",true);
+ cultures[34] = new Culture("ca-ES",0x0403,"Catalan - Catalan",true);
+ cultures[35] = new Culture("hr",0x001A,"Croatian",true);
+ cultures[36] = new Culture("hr-HR",0x041A,"Croatian - Croatia",true);
+ cultures[37] = new Culture("cs",0x0005,"Czech",true);
+ cultures[38] = new Culture("cs-CZ",0x0405,"Czech - Czech Republic",true);
+ cultures[39] = new Culture("da",0x0006,"Danish",true);
+ cultures[40] = new Culture("da-DK",0x0406,"Danish - Denmark",true);
+ cultures[41] = new Culture("dv",0x0065,"Dhivehi",true);
+ cultures[42] = new Culture("dv-MV",0x0465,"Dhivehi - Maldives",true);
+ cultures[43] = new Culture("nl",0x0013,"Dutch",true);
+ cultures[44] = new Culture("nl-BE",0x0813,"Dutch - Belgium",true);
+ cultures[45] = new Culture("nl-NL",0x0413,"Dutch - The Netherlands",true);
+ cultures[46] = new Culture("en",0x0009,"English",true);
+ cultures[47] = new Culture("en-AU",0x0C09,"English - Australia",true);
+ cultures[48] = new Culture("en-BZ",0x2809,"English - Belize",true);
+ cultures[49] = new Culture("en-CA",0x1009,"English - Canada",true);
+ cultures[50] = new Culture("en-029",0x2409,"English - Caribbean",true);
+ cultures[51] = new Culture("en-IE",0x1809,"English - Ireland",true);
+ cultures[52] = new Culture("en-JM",0x2009,"English - Jamaica",true);
+ cultures[53] = new Culture("en-NZ",0x1409,"English - New Zealand",true);
+ cultures[54] = new Culture("en-PH",0x3409,"English - Philippines",true);
+ cultures[55] = new Culture("en-ZA",0x1C09,"English - South Africa",true);
+ cultures[56] = new Culture("en-TT",0x2C09,"English - Trinidad and Tobago",true);
+ cultures[57] = new Culture("en-GB",0x0809,"English - United Kingdom",true);
+ cultures[58] = new Culture("en-US",0x0409,"English - United States",true);
+ cultures[59] = new Culture("en-ZW",0x3009,"English - Zimbabwe",true);
+ cultures[60] = new Culture("et",0x0025,"Estonian",true);
+ cultures[61] = new Culture("et-EE",0x0425,"Estonian - Estonia",true);
+ cultures[62] = new Culture("fo",0x0038,"Faroese",true);
+ cultures[63] = new Culture("fo-FO",0x0438,"Faroese - Faroe Islands",true);
+ cultures[64] = new Culture("fa",0x0029,"Farsi",true);
+ cultures[65] = new Culture("fa-IR",0x0429,"Farsi - Iran",true);
+ cultures[66] = new Culture("fi",0x000B,"Finnish",true);
+ cultures[67] = new Culture("fi-FI",0x040B,"Finnish - Finland",true);
+ cultures[68] = new Culture("fr",0x000C,"French",true);
+ cultures[69] = new Culture("fr-BE",0x080C,"French - Belgium",true);
+ cultures[70] = new Culture("fr-CA",0x0C0C,"French - Canada",true);
+ cultures[71] = new Culture("fr-FR",0x040C,"French - France",true);
+ cultures[72] = new Culture("fr-LU",0x140C,"French - Luxembourg",true);
+ cultures[73] = new Culture("fr-MC",0x180C,"French - Monaco",true);
+ cultures[74] = new Culture("fr-CH",0x100C,"French - Switzerland",true);
+ cultures[75] = new Culture("gl",0x0056,"Galician",true);
+ cultures[76] = new Culture("gl-ES",0x0456,"Galician - Galician",true);
+ cultures[77] = new Culture("ka",0x0037,"Georgian",true);
+ cultures[78] = new Culture("ka-GE",0x0437,"Georgian - Georgia",true);
+ cultures[79] = new Culture("de",0x0007,"German",true);
+ cultures[80] = new Culture("de-AT",0x0C07,"German - Austria",true);
+ cultures[81] = new Culture("de-DE",0x0407,"German - Germany",true);
+ cultures[82] = new Culture("de-LI",0x1407,"German - Liechtenstein",true);
+ cultures[83] = new Culture("de-LU",0x1007,"German - Luxembourg",true);
+ cultures[84] = new Culture("de-CH",0x0807,"German - Switzerland",true);
+ cultures[85] = new Culture("el",0x0008,"Greek",true);
+ cultures[86] = new Culture("el-GR",0x0408,"Greek - Greece",true);
+ cultures[87] = new Culture("gu",0x0047,"Gujarati",true);
+ cultures[88] = new Culture("gu-IN",0x0447,"Gujarati - India",true);
+ cultures[89] = new Culture("he",0x000D,"Hebrew",true);
+ cultures[90] = new Culture("he-IL",0x040D,"Hebrew - Israel",true);
+ cultures[91] = new Culture("hi",0x0039,"Hindi",true);
+ cultures[92] = new Culture("hi-IN",0x0439,"Hindi - India",true);
+ cultures[93] = new Culture("hu",0x000E,"Hungarian",true);
+ cultures[94] = new Culture("hu-HU",0x040E,"Hungarian - Hungary",true);
+ cultures[95] = new Culture("is",0x000F,"Icelandic",true);
+ cultures[96] = new Culture("is-IS",0x040F,"Icelandic - Iceland",true);
+ cultures[97] = new Culture("id",0x0021,"Indonesian",true);
+ cultures[98] = new Culture("id-ID",0x0421,"Indonesian - Indonesia",true);
+ cultures[99] = new Culture("it",0x0010,"Italian",true);
+ cultures[100] = new Culture("it-IT",0x0410,"Italian - Italy",true);
+ cultures[101] = new Culture("it-CH",0x0810,"Italian - Switzerland",true);
+ cultures[102] = new Culture("kn",0x004B,"Kannada",true);
+ cultures[103] = new Culture("kn-IN",0x044B,"Kannada - India",true);
+ cultures[104] = new Culture("kk",0x003F,"Kazakh",true);
+ cultures[105] = new Culture("kk-KZ",0x043F,"Kazakh - Kazakhstan",true);
+ cultures[106] = new Culture("kok",0x0057,"Konkani",true);
+ cultures[107] = new Culture("kok-IN",0x0457,"Konkani - India",true);
+ cultures[108] = new Culture("ky",0x0040,"Kyrgyz",true);
+ cultures[109] = new Culture("ky-KG",0x0440,"Kyrgyz - Kazakhstan",true);
+ cultures[110] = new Culture("lv",0x0026,"Latvian",true);
+ cultures[111] = new Culture("lv-LV",0x0426,"Latvian - Latvia",true);
+ cultures[112] = new Culture("lt",0x0027,"Lithuanian",true);
+ cultures[113] = new Culture("lt-LT",0x0427,"Lithuanian - Lithuania",true);
+ cultures[114] = new Culture("mk",0x002F,"Macedonian",true);
+ cultures[115] = new Culture("mk-MK",0x042F,"Macedonian - FYROM",true);
+ cultures[116] = new Culture("ms",0x003E,"Malay",true);
+ cultures[117] = new Culture("ms-BN",0x083E,"Malay - Brunei",true);
+ cultures[118] = new Culture("ms-MY",0x043E,"Malay - Malaysia",true);
+ cultures[119] = new Culture("mr",0x004E,"Marathi",true);
+ cultures[120] = new Culture("mr-IN",0x044E,"Marathi - India",true);
+ cultures[121] = new Culture("mn",0x0050,"Mongolian",true);
+ cultures[122] = new Culture("mn-MN",0x0450,"Mongolian - Mongolia",true);
+ cultures[123] = new Culture("no",0x0014,"Norwegian",true);
+ cultures[124] = new Culture("nb-NO",0x0414,"Norwegian (Bokm\u00e5l) - Norway",true);
+ cultures[125] = new Culture("nn-NO",0x0814,"Norwegian (Nynorsk) - Norway",true);
+ cultures[126] = new Culture("pl",0x0015,"Polish",true);
+ cultures[127] = new Culture("pl-PL",0x0415,"Polish - Poland",true);
+ cultures[128] = new Culture("pt",0x0016,"Portuguese",true);
+ cultures[129] = new Culture("pt-BR",0x0416,"Portuguese - Brazil",true);
+ cultures[130] = new Culture("pt-PT",0x0816,"Portuguese - Portugal",true);
+ cultures[131] = new Culture("pa",0x0046,"Punjabi",true);
+ cultures[132] = new Culture("pa-IN",0x0446,"Punjabi - India",true);
+ cultures[133] = new Culture("ro",0x0018,"Romanian",true);
+ cultures[134] = new Culture("ro-RO",0x0418,"Romanian - Romania",true);
+ cultures[135] = new Culture("ru",0x0019,"Russian",true);
+ cultures[136] = new Culture("ru-RU",0x0419,"Russian - Russia",true);
+ cultures[137] = new Culture("sa",0x004F,"Sanskrit",true);
+ cultures[138] = new Culture("sa-IN",0x044F,"Sanskrit - India",true);
+ cultures[139] = new Culture("sr-Cyrl-CS",0x0C1A,"Serbian (Cyrillic) - Serbia",true);
+ cultures[140] = new Culture("sr-Latn-CS",0x081A,"Serbian (Latin) - Serbia",true);
+ cultures[141] = new Culture("sk",0x001B,"Slovak",true);
+ cultures[142] = new Culture("sk-SK",0x041B,"Slovak - Slovakia",true);
+ cultures[143] = new Culture("sl",0x0024,"Slovenian",true);
+ cultures[144] = new Culture("sl-SI",0x0424,"Slovenian - Slovenia",true);
+ cultures[145] = new Culture("es",0x000A,"Spanish",true);
+ cultures[146] = new Culture("es-AR",0x2C0A,"Spanish - Argentina",true);
+ cultures[147] = new Culture("es-BO",0x400A,"Spanish - Bolivia",true);
+ cultures[148] = new Culture("es-CL",0x340A,"Spanish - Chile",true);
+ cultures[149] = new Culture("es-CO",0x240A,"Spanish - Colombia",true);
+ cultures[150] = new Culture("es-CR",0x140A,"Spanish - Costa Rica",true);
+ cultures[151] = new Culture("es-DO",0x1C0A,"Spanish - Dominican Republic",true);
+ cultures[152] = new Culture("es-EC",0x300A,"Spanish - Ecuador",true);
+ cultures[153] = new Culture("es-SV",0x440A,"Spanish - El Salvador",true);
+ cultures[154] = new Culture("es-GT",0x100A,"Spanish - Guatemala",true);
+ cultures[155] = new Culture("es-HN",0x480A,"Spanish - Honduras",true);
+ cultures[156] = new Culture("es-MX",0x080A,"Spanish - Mexico",true);
+ cultures[157] = new Culture("es-NI",0x4C0A,"Spanish - Nicaragua",true);
+ cultures[158] = new Culture("es-PA",0x180A,"Spanish - Panama",true);
+ cultures[159] = new Culture("es-PY",0x3C0A,"Spanish - Paraguay",true);
+ cultures[160] = new Culture("es-PE",0x280A,"Spanish - Peru",true);
+ cultures[161] = new Culture("es-PR",0x500A,"Spanish - Puerto Rico",true);
+ cultures[162] = new Culture("es-ES",0x0C0A,"Spanish - Spain",true);
+ cultures[163] = new Culture("es-UY",0x380A,"Spanish - Uruguay",true);
+ cultures[164] = new Culture("es-VE",0x200A,"Spanish - Venezuela",true);
+ cultures[165] = new Culture("sw",0x0041,"Swahili",true);
+ cultures[166] = new Culture("sw-KE",0x0441,"Swahili - Kenya",true);
+ cultures[167] = new Culture("sv",0x001D,"Swedish",true);
+ cultures[168] = new Culture("sv-FI",0x081D,"Swedish - Finland",true);
+ cultures[169] = new Culture("sv-SE",0x041D,"Swedish - Sweden",true);
+ cultures[170] = new Culture("syr",0x005A,"Syriac",true);
+ cultures[171] = new Culture("syr-SY",0x045A,"Syriac - Syria",true);
+ cultures[172] = new Culture("ta",0x0049,"Tamil",true);
+ cultures[173] = new Culture("ta-IN",0x0449,"Tamil - India",true);
+ cultures[174] = new Culture("tt",0x0044,"Tatar",true);
+ cultures[175] = new Culture("tt-RU",0x0444,"Tatar - Russia",true);
+ cultures[176] = new Culture("te",0x004A,"Telugu",true);
+ cultures[177] = new Culture("te-IN",0x044A,"Telugu - India",true);
+ cultures[178] = new Culture("th",0x001E,"Thai",true);
+ cultures[179] = new Culture("th-TH",0x041E,"Thai - Thailand",true);
+ cultures[180] = new Culture("tr",0x001F,"Turkish",true);
+ cultures[181] = new Culture("tr-TR",0x041F,"Turkish - Turkey",true);
+ cultures[182] = new Culture("uk",0x0022,"Ukrainian",true);
+ cultures[183] = new Culture("uk-UA",0x0422,"Ukrainian - Ukraine",true);
+ cultures[184] = new Culture("ur",0x0020,"Urdu",true);
+ cultures[185] = new Culture("ur-PK",0x0420,"Urdu - Pakistan",true);
+ cultures[186] = new Culture("uz",0x0043,"Uzbek",true);
+ cultures[187] = new Culture("uz-Cyrl-UZ",0x0843,"Uzbek (Cyrillic) - Uzbekistan",true);
+ cultures[188] = new Culture("uz-Latn-UZ",0x0443,"Uzbek (Latin) - Uzbekistan",true);
+ cultures[189] = new Culture("vi",0x002A,"Vietnamese",true);
+ cultures[190] = new Culture("vi-VN",0x042A,"Vietnamese - Vietnam",true);
+ }
+ }
+}
diff --git a/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_support/ThreadPool_Test.csproj b/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_support/ThreadPool_Test.csproj
new file mode 100644
index 0000000000..e375e0e42d
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_support/ThreadPool_Test.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="fibonacci.cs" />
+ <Compile Include="foo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_support/fibonacci.cs b/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_support/fibonacci.cs
new file mode 100644
index 0000000000..9bcd0747ba
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_support/fibonacci.cs
@@ -0,0 +1,71 @@
+// 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.
+/* ========================================================== *\
+ Fibonacci
+ Fibonacci.Compute WaitDelegate
+ Fibonacci.Check WaitOrTimerDelegate
+ Copyright (c) Microsoft, 1999-2000
+\* ========================================================== */
+using System;
+using System.Threading;
+using System.Security;
+
+#if WINCORESYS
+[assembly: AllowPartiallyTrustedCallers]
+#endif
+namespace ThreadPool_Test {
+ public class Fibonacci {
+ private int fibnumber;
+ public int iFlag;
+ private int fib(int x) {return ((x<=1)?1:(fib(x-1)+fib(x-2)));}
+ public Fibonacci(int num) {fibnumber=num;iFlag=0;}
+ public void SetNumber(int n){fibnumber=n;}
+
+ // WaitDelegate
+ public void Compute(Object o) {
+ int x = fib(fibnumber);
+ Console.WriteLine("Fibonacci.Compute({0})={1}",fibnumber,x);
+ }
+
+ // WaitOrTimerDelegate
+ public void Check(Object o, bool zTimex) {
+ iFlag=1;
+ Console.WriteLine("Fibonacci, {0}",((zTimex)?"timer expired":"wait signalled"));
+ if (!zTimex)
+ Compute(o);
+ }
+ }
+
+ public class Fibonacci2 {
+ private int fib(int x) {return ((x<=1)?1:(fib(x-1)+fib(x-2)));}
+ public Fibonacci2( ) {Console.WriteLine("Fibonacci2..ctor(int)");}
+
+ // WaitDelegate
+ public void Compute(Object o) {
+ SubFib sfLocal = (SubFib) o;
+ sfLocal.iRet = fib(sfLocal.iFibon);
+ Console.Write("({0}) ",sfLocal.iFibon);
+ Console.WriteLine("Fibonacci2.Compute({0})={1}",sfLocal.iFibon,sfLocal.iRet);
+ }
+
+ // WaitOrTimerDelegate
+ public void Check(Object o, bool zTimex) {
+ SubFib sfLocal = (SubFib) o;
+ sfLocal.iCheckFlag=1;
+ Console.Write("({0}) ",sfLocal.iFibon);
+// iFlag=1;
+ Console.WriteLine("Fibonacci2, {0}",((zTimex)?"timer expired":"wait signalled"));
+ if (!zTimex)
+ Compute(o);
+ }
+ }
+
+ public class SubFib {
+ public int iFibon;
+ public int iCheckFlag;
+ public int iRet;
+ public SubFib(int num) {iFibon=num;iCheckFlag=0;Console.WriteLine("SubFib..ctor({0})",num);}
+ }
+}
+
diff --git a/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_support/foo.cs b/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_support/foo.cs
new file mode 100644
index 0000000000..e054d81d8d
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_support/foo.cs
@@ -0,0 +1,20 @@
+// 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.
+/* ========================================================== *\
+ Class: Foo
+ Copyright (c) Microsoft, 1999
+\* ========================================================== */
+using System;
+using System.Threading;
+
+namespace ThreadPool_Test {
+ public class Foo {
+ private ManualResetEvent e;
+ public Foo(ManualResetEvent ev) {e = ev;}
+ public void f2(Object o) {Console.WriteLine("f2");}
+ public void f3(Object o) {Console.WriteLine("f3");}
+ public void f4(Object o) {Console.WriteLine("f4");}
+ public void f1(Object o) {Console.WriteLine("f1");e.Set( );}
+ }
+}
diff --git a/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_threadpoolnullchecks/CS_ThreadPoolNullChecks.csproj b/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_threadpoolnullchecks/CS_ThreadPoolNullChecks.csproj
new file mode 100644
index 0000000000..92dc5d38e9
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_threadpoolnullchecks/CS_ThreadPoolNullChecks.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>-trustedexe</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="cs_threadpoolnullchecks.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_threadpoolnullchecks/cs_threadpoolnullchecks.cs b/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_threadpoolnullchecks/cs_threadpoolnullchecks.cs
new file mode 100644
index 0000000000..ccb56485db
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_threadpoolnullchecks/cs_threadpoolnullchecks.cs
@@ -0,0 +1,49 @@
+// 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.Security;
+using System.Threading;
+
+#if WINCORESYS
+[assembly:AllowPartiallyTrustedCallers]
+#endif
+
+public class CS_ThreadPoolNullChecks {
+ public static void EventSig(Object state, bool wasSignalled) {
+ Console.WriteLine("In EventSig: {0}.", Thread.CurrentThread.GetHashCode());
+ Console.WriteLine("wasSignalled: " + wasSignalled);
+ }
+ public static int Main(String [] args) {
+ Console.WriteLine("CS_ThreadPoolNullChecks ...");
+ int ret = 100;
+ ManualResetEvent j = new ManualResetEvent(false);
+ try {
+ ThreadPool.RegisterWaitForSingleObject(null,new WaitOrTimerCallback(EventSig),null,20,false);
+ ret = 0; // Fail
+ }
+ catch (ArgumentNullException) {
+ }
+ try {
+ ThreadPool.RegisterWaitForSingleObject(null,null,null,20,false);
+ ret = 0; // Fail
+ }
+ catch (ArgumentNullException) {
+ }
+ try {
+ ThreadPool.RegisterWaitForSingleObject(j,null,null,20,false);
+ ret = 0; // Fail
+ }
+ catch (ArgumentNullException) {
+ }
+ try {
+ ThreadPool.QueueUserWorkItem(null);
+ Console.WriteLine("ThreadPool.QueueUserWorkItem(null) should have thrown an Exception!");
+ ret = 0; // Fail
+ }
+ catch (ArgumentNullException) {
+ }
+ Console.WriteLine(" ... CS_ThreadPoolNullChecks (ret == {0})",ret);
+ return ret;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/regression/v1/threads/hostedscenario/apunload/MgdHelper.csproj b/tests/src/baseservices/regression/v1/threads/hostedscenario/apunload/MgdHelper.csproj
new file mode 100644
index 0000000000..b10f9a6e35
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/threads/hostedscenario/apunload/MgdHelper.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="mgdhelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/regression/v1/threads/hostedscenario/apunload/mgdhelper.cs b/tests/src/baseservices/regression/v1/threads/hostedscenario/apunload/mgdhelper.cs
new file mode 100644
index 0000000000..678b776a8e
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/threads/hostedscenario/apunload/mgdhelper.cs
@@ -0,0 +1,55 @@
+// 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.Runtime.InteropServices;
+using System.Reflection;
+using System.Threading;
+
+namespace Helper
+{
+ public interface ISample
+ {
+ int SpinThread();
+ }
+
+ [ClassInterface(ClassInterfaceType.None)]
+ public class Sample : ISample
+ {
+
+ int aNumber;
+ Thread t;
+
+ public Sample()
+ {
+ aNumber = 500;
+ t = null;
+ }
+
+ public int SpinThread()
+ {
+ Console.WriteLine("Inside Sample::SpinThread");
+ t = new Thread(new ThreadStart(WorkerFunc));
+ t.Start();
+ return aNumber;
+ }
+
+ public static void WorkerFunc()
+ {
+ Console.WriteLine("Inside Sample::SpinThread::WorkerFunction");
+ Console.WriteLine(" The following loop will not end...");
+ int i = 0;
+ while (true)
+ {
+ if(i%1000 == 0)
+ Console.WriteLine("Iteration::{0}",i++);
+ }
+ //Console.WriteLine("Exit Sample::SpinThread::WorkerFunction");
+ }
+
+ ~Sample()
+ {
+ Console.WriteLine("Inside Sample::Finalize");
+ }
+ }
+}
diff --git a/tests/src/baseservices/regression/v1/threads/hostedscenario/apunloadtwo/interoptest.csproj b/tests/src/baseservices/regression/v1/threads/hostedscenario/apunloadtwo/interoptest.csproj
new file mode 100644
index 0000000000..30366eb0cd
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/threads/hostedscenario/apunloadtwo/interoptest.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="sample.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/regression/v1/threads/hostedscenario/apunloadtwo/sample.cs b/tests/src/baseservices/regression/v1/threads/hostedscenario/apunloadtwo/sample.cs
new file mode 100644
index 0000000000..f9902040b2
--- /dev/null
+++ b/tests/src/baseservices/regression/v1/threads/hostedscenario/apunloadtwo/sample.cs
@@ -0,0 +1,95 @@
+// 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.Runtime.InteropServices;
+using System.Reflection;
+using System.Threading;
+
+namespace interoptest
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ //[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface ISample
+ {
+ int GetANumber();
+ [return:MarshalAs(UnmanagedType.IUnknown)]
+ object GetAnObject();
+ HelperClass GetAnHelperClass();
+ }
+
+ public interface IHelper
+ {
+ string GetName();
+ }
+
+ [ClassInterface(ClassInterfaceType.None)]
+ public class Sample : ISample
+ {
+
+ int aNumber;
+ HelperClass myObject;
+ Thread t;
+
+ public Sample()
+ {
+ aNumber = 19;
+ myObject = new HelperClass("ferit");
+ t = null;
+ }
+
+ public int GetZero()
+ {
+ return 0;
+ }
+
+ public int GetANumber()
+ {
+ ThreadStart worker = new ThreadStart(WorkerThreadMethod);
+ Console.WriteLine("Inside Sample::GetANumber");
+
+ t = new Thread(worker);
+ t.Start();
+
+ return aNumber;
+ }
+
+ public static void WorkerThreadMethod()
+ {
+ Console.WriteLine("inside Worker Thread");
+ }
+
+ public object GetAnObject()
+ {
+ return myObject;
+ }
+
+ public HelperClass GetAnHelperClass()
+ {
+ return myObject;
+ }
+
+ ~Sample()
+ {
+ Console.WriteLine("Inside Sample::Finalize");
+ }
+ }
+
+ [ClassInterface(ClassInterfaceType.None)]
+ public class HelperClass : IHelper
+ {
+ string theName;
+
+ public HelperClass(string name)
+ {
+ theName = name;
+ }
+
+ public string GetName()
+ {
+ return theName;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/commitstackonlyasneeded/DefaultStackCommit.cs b/tests/src/baseservices/threading/commitstackonlyasneeded/DefaultStackCommit.cs
new file mode 100644
index 0000000000..508d575948
--- /dev/null
+++ b/tests/src/baseservices/threading/commitstackonlyasneeded/DefaultStackCommit.cs
@@ -0,0 +1,29 @@
+// 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.Collections.Generic;
+using System.Linq;
+using System.Text;
+// using System.Configuration;
+using System.Runtime.InteropServices;
+
+namespace StackCommitTest
+{
+ class DefaultStackCommit
+ {
+ static int Main(string[] args)
+ {
+ int result = 1;
+ bool commitEnabled = false;
+
+ if (Utility.RunTest(commitEnabled))
+ {
+ result = 100;
+ }
+
+ Console.WriteLine(result == 100 ? "Success!" : "FAILED!");
+ return result;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/commitstackonlyasneeded/DefaultStackCommit.csproj b/tests/src/baseservices/threading/commitstackonlyasneeded/DefaultStackCommit.csproj
new file mode 100644
index 0000000000..f9b1274fd9
--- /dev/null
+++ b/tests/src/baseservices/threading/commitstackonlyasneeded/DefaultStackCommit.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{c485e164-f82c-4a4f-a02e-bc711827e5be}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="DefaultStackCommit.cs" />
+ <Compile Include="StackCommitCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/commitstackonlyasneeded/DisablePreCommit.exe.config b/tests/src/baseservices/threading/commitstackonlyasneeded/DisablePreCommit.exe.config
new file mode 100644
index 0000000000..eaa1bdc3f4
--- /dev/null
+++ b/tests/src/baseservices/threading/commitstackonlyasneeded/DisablePreCommit.exe.config
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <runtime>
+ <disableCommitThreadStack enabled="1" />
+ </runtime>
+ <appSettings>
+ <add key="expectStackCommit" value="false"/>
+ </appSettings>
+</configuration>
diff --git a/tests/src/baseservices/threading/commitstackonlyasneeded/EnablePreCommit.exe.config b/tests/src/baseservices/threading/commitstackonlyasneeded/EnablePreCommit.exe.config
new file mode 100644
index 0000000000..cc68420ce8
--- /dev/null
+++ b/tests/src/baseservices/threading/commitstackonlyasneeded/EnablePreCommit.exe.config
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <runtime>
+ <disableCommitThreadStack enabled="0" />
+ </runtime>
+ <appSettings>
+ <add key="expectStackCommit" value="true"/>
+ </appSettings>
+</configuration>
diff --git a/tests/src/baseservices/threading/commitstackonlyasneeded/StackCommitCommon.cs b/tests/src/baseservices/threading/commitstackonlyasneeded/StackCommitCommon.cs
new file mode 100644
index 0000000000..fef88b1306
--- /dev/null
+++ b/tests/src/baseservices/threading/commitstackonlyasneeded/StackCommitCommon.cs
@@ -0,0 +1,244 @@
+// 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.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Runtime.InteropServices;
+using System.Threading;
+//using System.Configuration;
+
+namespace StackCommitTest
+{
+ public unsafe class WinApi
+ {
+ [DllImport("kernel32.dll")]
+ public static extern void GetSystemInfo([MarshalAs(UnmanagedType.Struct)] ref SYSTEM_INFO lpSystemInfo);
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct SYSTEM_INFO
+ {
+ internal PROCESSOR_INFO_UNION uProcessorInfo;
+ public uint dwPageSize;
+ public IntPtr lpMinimumApplicationAddress;
+ public IntPtr lpMaximumApplicationAddress;
+ public IntPtr dwActiveProcessorMask;
+ public uint dwNumberOfProcessors;
+ public uint dwProcessorType;
+ public uint dwAllocationGranularity;
+ public ushort dwProcessorLevel;
+ public ushort dwProcessorRevision;
+ }
+
+ [StructLayout(LayoutKind.Explicit)]
+ public struct PROCESSOR_INFO_UNION
+ {
+ [FieldOffset(0)]
+ internal uint dwOemId;
+ [FieldOffset(0)]
+ internal ushort wProcessorArchitecture;
+ [FieldOffset(2)]
+ internal ushort wReserved;
+ }
+
+ [DllImport("kernel32")]
+ public static extern IntPtr VirtualQuery(void* address, ref MEMORY_BASIC_INFORMATION buffer, IntPtr length);
+
+ public struct MEMORY_BASIC_INFORMATION
+ {
+ public byte* BaseAddress;
+ public byte* AllocationBase;
+ public int AllocationProtect;
+ public IntPtr RegionSize;
+ public MemState State;
+ public int Protect;
+ public int Type;
+ }
+
+ [Flags]
+ public enum MemState
+ {
+ MEM_COMMIT = 0x1000,
+ MEM_RESERVE = 0x2000,
+ MEM_FREE = 0x10000,
+ }
+
+
+ public const int PAGE_GUARD = 0x100;
+
+ }
+
+ unsafe public static class Utility
+ {
+ public static Int64 PageSize { get; private set; }
+
+ static Utility()
+ {
+ WinApi.SYSTEM_INFO sysInfo = new WinApi.SYSTEM_INFO();
+
+ WinApi.GetSystemInfo(ref sysInfo);
+
+ PageSize = (Int64)sysInfo.dwPageSize;
+ }
+
+ public static void GetStackExtents(out byte* stackBase, out long stackSize)
+ {
+ WinApi.MEMORY_BASIC_INFORMATION info = new WinApi.MEMORY_BASIC_INFORMATION();
+ WinApi.VirtualQuery(&info, ref info, new IntPtr(sizeof(WinApi.MEMORY_BASIC_INFORMATION)));
+ stackBase = info.AllocationBase;
+ stackSize = (info.BaseAddress - info.AllocationBase) + info.RegionSize.ToInt64();
+ }
+
+ public static List<WinApi.MEMORY_BASIC_INFORMATION> GetRegionsOfStack()
+ {
+ byte* stackBase;
+ long stackSize;
+ GetStackExtents(out stackBase, out stackSize);
+
+ List<WinApi.MEMORY_BASIC_INFORMATION> result = new List<WinApi.MEMORY_BASIC_INFORMATION>();
+
+ byte* current = stackBase;
+ while (current < stackBase + stackSize)
+ {
+ WinApi.MEMORY_BASIC_INFORMATION info = new WinApi.MEMORY_BASIC_INFORMATION();
+ WinApi.VirtualQuery(current, ref info, new IntPtr(sizeof(WinApi.MEMORY_BASIC_INFORMATION)));
+ result.Add(info);
+ current = info.BaseAddress + info.RegionSize.ToInt64();
+ }
+
+ result.Reverse();
+ return result;
+ }
+
+
+ public static bool ValidateStack(string threadName, bool shouldBePreCommitted, Int32 expectedStackSize)
+ {
+ bool result = true;
+
+ byte* stackBase;
+ long stackSize;
+ GetStackExtents(out stackBase, out stackSize);
+
+ Console.WriteLine("{2} -- Base: {0:x}, Size: {1}kb", new IntPtr(stackBase).ToInt64(), stackSize / 1024, threadName);
+
+ //
+ // Start at the highest addresses, which should be committed (because that's where we're currently running).
+ // The next region should be committed, but marked as a guard page.
+ // After that, we'll either find committed pages, or reserved pages, depending on whether the runtime
+ // is pre-committing stacks.
+ //
+ bool foundGuardRegion = false;
+
+ foreach (var info in GetRegionsOfStack())
+ {
+ string regionType = string.Empty;
+
+ if (!foundGuardRegion)
+ {
+ if ((info.Protect & WinApi.PAGE_GUARD) != 0)
+ {
+ foundGuardRegion = true;
+ regionType = "guard region";
+ }
+ else
+ {
+ regionType = "active region";
+ }
+ }
+ else
+ {
+ if (shouldBePreCommitted)
+ {
+ if (!info.State.HasFlag(WinApi.MemState.MEM_COMMIT))
+ {
+ // If we pre-commit the stack, the last 1 or 2 pages are left "reserved" (they are the "hard guard region")
+ // ??? How to decide whether it is 1 or 2 pages?
+ if ((info.BaseAddress != stackBase || info.RegionSize.ToInt64() > PageSize))
+ {
+ result = false;
+ regionType = "<---- should be pre-committed";
+ }
+ }
+ }
+ else
+ {
+ if (info.State.HasFlag(WinApi.MemState.MEM_COMMIT))
+ {
+ result = false;
+ regionType = "<---- should not be pre-committed";
+ }
+ }
+ }
+
+ Console.WriteLine(
+ "{0:x8}-{1:x8} {2,5:g}kb {3,-11:g} {4}",
+ new IntPtr(info.BaseAddress).ToInt64(),
+ new IntPtr(info.BaseAddress + info.RegionSize.ToInt64()).ToInt64(),
+ info.RegionSize.ToInt64() / 1024,
+ info.State,
+ regionType);
+ }
+
+ if (!foundGuardRegion)
+ {
+ result = false;
+
+ Console.WriteLine("Did not find GuardRegion for the whole stack");
+ }
+
+ if (expectedStackSize != -1 && stackSize != expectedStackSize)
+ {
+ result = false;
+
+ Console.WriteLine("Stack size is not as expected: actual -- {0}, expected -- {1}", stackSize, expectedStackSize);
+ }
+
+ Console.WriteLine();
+ return result;
+ }
+
+ static private bool RunTestItem(string threadName, bool shouldBePreCommitted, Int32 expectedThreadSize, Action<Action> runOnThread)
+ {
+ bool result = false;
+ ManualResetEventSlim mre = new ManualResetEventSlim();
+
+ runOnThread(() =>
+ {
+ result = Utility.ValidateStack(threadName, shouldBePreCommitted, expectedThreadSize);
+ mre.Set();
+ });
+
+ mre.Wait();
+ return result;
+ }
+
+ static public bool RunTest(bool shouldBePreCommitted)
+ {
+ if (RunTestItem("Main", shouldBePreCommitted, -1, action => action()) &
+ RunTestItem("ThreadPool", shouldBePreCommitted, -1, action => ThreadPool.QueueUserWorkItem(state => action())) &
+ RunTestItem("new Thread()", shouldBePreCommitted, -1, action => new Thread(() => action()).Start()) &
+ //RunTestItem("new Thread(512kb)", true, 512 * 1024, action => new Thread(() => action(), 512 * 1024).Start()) &
+ RunTestItem("Finalizer", shouldBePreCommitted, -1, action => Finalizer.Run(action)))
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ public class Finalizer
+ {
+ Action m_action;
+ private Finalizer(Action action) { m_action = action; }
+ ~Finalizer() { m_action(); }
+
+ public static void Run(Action action)
+ {
+ new Finalizer(action);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_ARENullRefEx.cs b/tests/src/baseservices/threading/coverage/Nullref/CS_ARENullRefEx.cs
new file mode 100644
index 0000000000..277dc1cade
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_ARENullRefEx.cs
@@ -0,0 +1,150 @@
+// 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.Threading;
+
+public class mytest {
+ public static int Main(String [] args) {
+ int rValue = 100;
+ AutoResetEvent are = null;
+
+ Console.WriteLine("Test AutoResetEvent for expected NullRef Exceptions");
+ Console.WriteLine( );
+
+
+// try {
+// #pragma warning disable 618
+// are.Handle = new IntPtr(1);
+// #pragma warning restore 618
+// rValue = 1;
+// }
+// catch (NullReferenceException) {
+// Console.WriteLine("Caught NullReferenceException (are.Handle(new IntPtr(1)))");
+// }
+// try {
+// #pragma warning disable 618
+// IntPtr iptr = are.Handle;
+// #pragma warning restore 618
+// rValue = 2;
+// }
+// catch (NullReferenceException) {
+// Console.WriteLine("Caught NullReferenceException (IntPtr iptr = are.Handle)");
+// }
+
+ // try {
+ // are.Close();
+ // rValue = 3;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (are.Close())");
+ // }
+
+ try {
+ are.Equals(new ManualResetEvent(true));
+ rValue = 4;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (are.Equals(new ManualResetEvent()))");
+ }
+
+ try {
+ are.GetHashCode();
+ rValue = 5;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (are.GetHasCode())");
+ }
+
+ // try {
+ // are.GetLifetimeService();
+ // rValue = 6;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (are.GetLifetimeService())");
+ // }
+
+ try {
+ are.GetType();
+ rValue = 7;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (are.GetType())");
+ }
+
+ // try {
+ // are.InitializeLifetimeService();
+ // rValue = 8;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (are.InitializeLifeTimeService())");
+ // }
+
+ try {
+ are.Reset();
+ rValue = 9;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (are.Reset())");
+ }
+
+ try {
+ are.Set();
+ rValue = 10;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (are.Set())");
+ }
+
+ try {
+ are.ToString();
+ rValue = 11;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (are.ToString())");
+ }
+
+ try {
+ are.WaitOne();
+ rValue = 12;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (are.WaitOne())");
+ }
+
+ try {
+ are.WaitOne(1000);//,true);
+ rValue = 13;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (are.WaitOne(int,bool))");
+ }
+
+ // try {
+ // are.WaitOne(1000);//,false);
+ // rValue = 14;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (are.WaitOne(int,bool))");
+ // }
+
+ try {
+ are.WaitOne(new TimeSpan(1000));//,true);
+ rValue = 15;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (are.WaitOne(TimeSpan,bool))");
+ }
+
+ // try {
+ // are.WaitOne(new TimeSpan(1000));//,false);
+ // rValue = 16;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (are.WaitOne(TimeSpan,bool))");
+ // }
+
+ Console.WriteLine("Return Code == {0}",rValue);
+ return rValue;
+ }
+}
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_ARENullRefEx.csproj b/tests/src/baseservices/threading/coverage/Nullref/CS_ARENullRefEx.csproj
new file mode 100644
index 0000000000..be7d54ff2a
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_ARENullRefEx.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CS_ARENullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_MRENullRefEx.cs b/tests/src/baseservices/threading/coverage/Nullref/CS_MRENullRefEx.cs
new file mode 100644
index 0000000000..a273bc72e9
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_MRENullRefEx.cs
@@ -0,0 +1,150 @@
+// 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.Threading;
+
+public class mytest {
+ public static int Main(String [] args) {
+ int rValue = 100;
+ ManualResetEvent mre = null;
+
+ Console.WriteLine("Test ManualResetEvent for expected NullRef Exceptions");
+ Console.WriteLine( );
+
+
+// try {
+// #pragma warning disable 618
+// mre.Handle = new IntPtr(1);
+// #pragma warning restore 618
+// rValue = 1;
+// }
+// catch (NullReferenceException) {
+// Console.WriteLine("Caught NullReferenceException (mre.Handle(new IntPtr(1)))");
+// }
+// try {
+// #pragma warning disable 618
+// IntPtr iptr = mre.Handle;
+// #pragma warning restore 618
+// rValue = 2;
+// }
+// catch (NullReferenceException) {
+// Console.WriteLine("Caught NullReferenceException (IntPtr iptr = mre.Handle)");
+// }
+
+ // try {
+ // mre.Close();
+ // rValue = 3;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (mre.Close())");
+ // }
+
+ try {
+ mre.Equals(new ManualResetEvent(true));
+ rValue = 4;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mre.Equals(new ManualResetEvent()))");
+ }
+
+ try {
+ mre.GetHashCode();
+ rValue = 5;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mre.GetHasCode())");
+ }
+
+ // try {
+ // mre.GetLifetimeService();
+ // rValue = 6;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (mre.GetLifetimeService())");
+ // }
+
+ try {
+ mre.GetType();
+ rValue = 7;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mre.GetType())");
+ }
+
+ // try {
+ // mre.InitializeLifetimeService();
+ // rValue = 8;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (mre.InitializeLifeTimeService())");
+ // }
+
+ try {
+ mre.Reset();
+ rValue = 9;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mre.Reset())");
+ }
+
+ try {
+ mre.Set();
+ rValue = 10;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mre.Set())");
+ }
+
+ try {
+ mre.ToString();
+ rValue = 11;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mre.ToString())");
+ }
+
+ try {
+ mre.WaitOne();
+ rValue = 12;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mre.WaitOne())");
+ }
+
+ try {
+ mre.WaitOne(1000);//,true);
+ rValue = 13;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mre.WaitOne(int)");
+ }
+
+ // try {
+ // mre.WaitOne(1000);//,false);
+ // rValue = 14;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (mre.WaitOne(int,bool))");
+ // }
+
+ try {
+ mre.WaitOne(new TimeSpan(1000));//,true);
+ rValue = 15;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mre.WaitOne(TimeSpan)");
+ }
+
+ // try {
+ // mre.WaitOne(new TimeSpan(1000));//,false);
+ // rValue = 16;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (mre.WaitOne(TimeSpan,bool))");
+ // }
+
+ Console.WriteLine("Return Code == {0}",rValue);
+ return rValue;
+ }
+}
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_MRENullRefEx.csproj b/tests/src/baseservices/threading/coverage/Nullref/CS_MRENullRefEx.csproj
new file mode 100644
index 0000000000..fd2c79add3
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_MRENullRefEx.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CS_MRENullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_MutexNullRefEx.cs b/tests/src/baseservices/threading/coverage/Nullref/CS_MutexNullRefEx.cs
new file mode 100644
index 0000000000..d339838d96
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_MutexNullRefEx.cs
@@ -0,0 +1,142 @@
+// 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.Threading;
+
+public class mytest {
+ public static int Main(String [] args) {
+ int rValue = 100;
+ Mutex mut = null;
+
+ Console.WriteLine("Test Mutex for expected NullRef Exceptions");
+ Console.WriteLine( );
+
+
+// try {
+// #pragma warning disable 618
+// mut.Handle = new IntPtr(1);
+// #pragma warning restore 618
+// rValue = 1;
+// }
+// catch (NullReferenceException) {
+// Console.WriteLine("Caught NullReferenceException (mut.Handle(new IntPtr(1)))");
+// }
+// try {
+// #pragma warning disable 618
+// IntPtr iptr = mut.Handle;
+// #pragma warning restore 618
+// rValue = 2;
+// }
+// catch (NullReferenceException) {
+// Console.WriteLine("Caught NullReferenceException (IntPtr iptr = mut.Handle)");
+// }
+
+ // try {
+ // mut.Close();
+ // rValue = 3;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (mut.Close())");
+ // }
+
+ try {
+ mut.Equals(new ManualResetEvent(true));
+ rValue = 4;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mut.Equals(new ManualResetEvent()))");
+ }
+
+ try {
+ mut.GetHashCode();
+ rValue = 5;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mut.GetHasCode())");
+ }
+
+ // try {
+ // mut.GetLifetimeService();
+ // rValue = 6;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (mut.GetLifetimeService())");
+ // }
+
+ try {
+ mut.GetType();
+ rValue = 7;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mut.GetType())");
+ }
+
+ // try {
+ // mut.InitializeLifetimeService();
+ // rValue = 8;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (mut.InitializeLifeTimeService())");
+ // }
+
+ try {
+ mut.ReleaseMutex();
+ rValue = 9;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mut.ReleaseMutex())");
+ }
+
+ try {
+ mut.ToString();
+ rValue = 11;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mut.ToString())");
+ }
+
+ try {
+ mut.WaitOne();
+ rValue = 12;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mut.WaitOne())");
+ }
+
+ try {
+ mut.WaitOne(1000);//,true);
+ rValue = 13;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mut.WaitOne(int)");
+ }
+
+ // try {
+ // mut.WaitOne(1000,false);
+ // rValue = 14;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (mut.WaitOne(int,bool))");
+ // }
+
+ try {
+ mut.WaitOne(new TimeSpan(1000));//,true);
+ rValue = 15;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (mut.WaitOne(TimeSpan))");
+ }
+
+ // try {
+ // mut.WaitOne(new TimeSpan(1000),false);
+ // rValue = 16;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (mut.WaitOne(TimeSpan,bool))");
+ // }
+
+ Console.WriteLine("Return Code == {0}",rValue);
+ return rValue;
+ }
+}
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_MutexNullRefEx.csproj b/tests/src/baseservices/threading/coverage/Nullref/CS_MutexNullRefEx.csproj
new file mode 100644
index 0000000000..0c7840561d
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_MutexNullRefEx.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CS_MutexNullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.cs b/tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.cs
new file mode 100644
index 0000000000..d50826df4c
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.cs
@@ -0,0 +1,76 @@
+// 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.Threading;
+
+public class mytest {
+ public static int Main(String [] args) {
+ int rValue = 100;
+ RegisteredWaitHandle rwh = null;
+
+ Console.WriteLine("Test AutoResetEvent for expected NullRef Exceptions");
+ Console.WriteLine( );
+
+
+ try {
+ rwh.Equals(new ManualResetEvent(true));
+ rValue = 4;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (rwh.Equals(new ManualResetEvent()))");
+ }
+
+ try {
+ rwh.GetHashCode();
+ rValue = 5;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (rwh.GetHasCode())");
+ }
+
+ // try {
+ // rwh.GetLifetimeService();
+ // rValue = 6;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (rwh.GetLifetimeService())");
+ // }
+
+ try {
+ rwh.GetType();
+ rValue = 7;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (rwh.GetType())");
+ }
+
+ // try {
+ // rwh.InitializeLifetimeService();
+ // rValue = 8;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (rwh.InitializeLifeTimeService())");
+ // }
+
+ try {
+ rwh.ToString();
+ rValue = 11;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (rwh.ToString())");
+ }
+
+ try {
+ rwh.Unregister(new AutoResetEvent(true));
+ rValue = 12;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (rwh.Unregister())");
+ }
+
+
+ Console.WriteLine("Return Code == {0}",rValue);
+ return rValue;
+ }
+}
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.csproj b/tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.csproj
new file mode 100644
index 0000000000..41d0dddd6f
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CS_RWHNullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_SLENullRefEx.cs b/tests/src/baseservices/threading/coverage/Nullref/CS_SLENullRefEx.cs
new file mode 100644
index 0000000000..58def9cc96
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_SLENullRefEx.cs
@@ -0,0 +1,125 @@
+// 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.Threading;
+// using System.Runtime.Remoting;
+using System.Runtime.Serialization;
+
+public class mytest {
+ public static int Main(String [] args) {
+ int rValue = 100;
+ SynchronizationLockException sle = null;
+
+ Console.WriteLine("Test AutoResetEvent for expected NullRef Exceptions");
+ Console.WriteLine( );
+
+ try {
+ sle.HelpLink = "Hello";
+ rValue = 1;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (sle.HelpLink = Hello)");
+ }
+
+ try {
+ String s = sle.HelpLink;
+ rValue = 2;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (string s = sle.HelpLink)");
+ }
+
+ try {
+ Exception e = sle.InnerException;
+ rValue = 3;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (sle.InnerException)");
+ }
+
+ try {
+ String s = sle.Message;
+ rValue = 4;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (sle.Message)");
+ }
+
+ try {
+ String s = sle.Source;
+ rValue = 5;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (sle.Source)");
+ }
+
+ try {
+ String s = sle.StackTrace;
+ rValue = 6;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (sle.StackTrace)");
+ }
+
+ // try {
+ // sle.TargetSite.ToString();
+ // rValue = 7;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (sle.TargetSite))");
+ // }
+
+ try {
+ sle.Equals(new Exception("Hello"));
+ rValue = 8;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (sle.Equals(new Exception()))");
+ }
+
+ try {
+ sle.GetBaseException();
+ rValue = 9;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (sle.GetBaseException())");
+ }
+
+ try {
+ sle.GetHashCode();
+ rValue = 10;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (sle.GetHasCode())");
+ }
+
+ // try {
+ // sle.GetObjectData(new SerializationInfo(1.GetType(),new FormatterConverter()),new StreamingContext(StreamingContextStates.All));
+ // rValue = 11;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (sle.ObjectData(SerializationInfo,StreamingContext))");
+ // }
+
+ try {
+ sle.GetType();
+ rValue = 12;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (sle.GetType())");
+ }
+
+ try {
+ sle.ToString();
+ rValue = 13;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (sle.ToString())");
+ }
+
+
+ Console.WriteLine("Return Code == {0}",rValue);
+ return rValue;
+ }
+}
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_SLENullRefEx.csproj b/tests/src/baseservices/threading/coverage/Nullref/CS_SLENullRefEx.csproj
new file mode 100644
index 0000000000..2f358880cf
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_SLENullRefEx.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CS_SLENullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_TSNullRefEx.cs b/tests/src/baseservices/threading/coverage/Nullref/CS_TSNullRefEx.cs
new file mode 100644
index 0000000000..c969534083
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_TSNullRefEx.cs
@@ -0,0 +1,124 @@
+// 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.Threading;
+using System.Runtime.Serialization;
+
+public class mytest {
+ public static int Main(String [] args) {
+ int rValue = 100;
+ ThreadStateException ta = null;
+
+ Console.WriteLine("Test AutoResetEvent for expected NullRef Exceptions");
+ Console.WriteLine( );
+
+ try {
+ ta.HelpLink = "Hello";
+ rValue = 1;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (ta.HelpLink = Hello)");
+ }
+
+ try {
+ String s = ta.HelpLink;
+ rValue = 2;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (string s = ta.HelpLink)");
+ }
+
+ try {
+ Exception e = ta.InnerException;
+ rValue = 3;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (ta.InnerException)");
+ }
+
+ try {
+ String s = ta.Message;
+ rValue = 4;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (ta.Message)");
+ }
+
+ try {
+ String s = ta.Source;
+ rValue = 5;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (ta.Source)");
+ }
+
+ try {
+ String s = ta.StackTrace;
+ rValue = 6;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (ta.StackTrace)");
+ }
+
+ // try {
+ // ta.TargetSite.ToString();
+ // rValue = 7;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (ta.TargetSite))");
+ // }
+
+ try {
+ ta.Equals(new Exception("Hello"));
+ rValue = 8;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (ta.Equals(new Exception()))");
+ }
+
+ try {
+ ta.GetBaseException();
+ rValue = 9;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (ta.GetBaseException())");
+ }
+
+ try {
+ ta.GetHashCode();
+ rValue = 10;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (ta.GetHasCode())");
+ }
+
+ // try {
+ // ta.GetObjectData(new SerializationInfo(1.GetType(),new FormatterConverter()),new StreamingContext(StreamingContextStates.All));
+ // rValue = 11;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (ta.ObjectData(SerializationInfo,StreamingContext))");
+ // }
+
+ try {
+ ta.GetType();
+ rValue = 12;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (ta.GetType())");
+ }
+
+ try {
+ ta.ToString();
+ rValue = 13;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (ta.ToString())");
+ }
+
+
+ Console.WriteLine("Return Code == {0}",rValue);
+ return rValue;
+ }
+}
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_TSNullRefEx.csproj b/tests/src/baseservices/threading/coverage/Nullref/CS_TSNullRefEx.csproj
new file mode 100644
index 0000000000..580a83b291
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_TSNullRefEx.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CS_TSNullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_TimerNullRefEx.cs b/tests/src/baseservices/threading/coverage/Nullref/CS_TimerNullRefEx.cs
new file mode 100644
index 0000000000..8c4c7170ed
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_TimerNullRefEx.cs
@@ -0,0 +1,114 @@
+// 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.Threading;
+
+public class mytest {
+ public static int Main(String [] args) {
+
+ int rValue = 100;
+ Timer time = null;
+
+ Console.WriteLine("Test that timer fields return correct null ref");
+
+ try {
+ time.Change(5,10);
+ rValue = 1;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (time.Change(5,10)");
+ }
+
+ try {
+ time.Change(5,10);
+ rValue = 2;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (time.Change((long)5,(long)10)");
+ }
+
+ try {
+ time.Change(new TimeSpan(500),new TimeSpan(100));
+ rValue = 3;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (time.Change(new TimeSpan(500),new TimeSpan(100))");
+ }
+
+ try {
+ time.Change(500,100);
+ rValue = 4;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (time.Change((uint)500,(uint)100)");
+ }
+
+ try {
+ time.Dispose();
+ rValue = 5;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (time.Dispose( ))");
+ }
+
+ // try {
+ // time.Dispose(new AutoResetEvent(true));
+ // rValue = 6;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (time.Dispose(new WaitHandle( )))");
+ // }
+
+ try {
+ time.Equals(new AutoResetEvent(true));
+ rValue = 7;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (time.Equals(new WaitHandle( )))");
+ }
+
+ try {
+ time.GetHashCode();
+ rValue = 8;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (time.GetHashCode())");
+ }
+
+ // try {
+ // time.GetLifetimeService();
+ // rValue = 9;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (time.GetLifetimeService())");
+ // }
+
+ try {
+ time.GetType();
+ rValue = 10;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (time.GetType())");
+ }
+
+ // try {
+ // time.InitializeLifetimeService();
+ // rValue = 11;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (time.InitializeLifetimeService())");
+ // }
+
+ try {
+ time.ToString();
+ rValue = 12;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (time.ToString())");
+ }
+
+ Console.WriteLine("Return Code == {0}",rValue);
+ return rValue;
+ }
+}
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_TimerNullRefEx.csproj b/tests/src/baseservices/threading/coverage/Nullref/CS_TimerNullRefEx.csproj
new file mode 100644
index 0000000000..496cf06ab8
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_TimerNullRefEx.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CS_TimerNullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_WHNullRefEx.cs b/tests/src/baseservices/threading/coverage/Nullref/CS_WHNullRefEx.cs
new file mode 100644
index 0000000000..2067e12b83
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_WHNullRefEx.cs
@@ -0,0 +1,134 @@
+// 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.Threading;
+
+public class mytest {
+ public static int Main(String [] args) {
+ int rValue = 100;
+ WaitHandle wh = null;
+
+ Console.WriteLine("Test AutoResetEvent for expected NullRef Exceptions");
+ Console.WriteLine( );
+
+
+// try {
+// #pragma warning disable 618
+// wh.Handle = new IntPtr(1);
+// #pragma warning restore 618
+// rValue = 1;
+// }
+// catch (NullReferenceException) {
+// Console.WriteLine("Caught NullReferenceException (wh.Handle(new IntPtr(1)))");
+// }
+// try {
+// #pragma warning disable 618
+// IntPtr iptr = wh.Handle;
+// #pragma warning restore 618
+// rValue = 2;
+// }
+// catch (NullReferenceException) {
+// Console.WriteLine("Caught NullReferenceException (IntPtr iptr = wh.Handle)");
+// }
+
+ // try {
+ // wh.Close();
+ // rValue = 3;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (wh.Close())");
+ // }
+
+ try {
+ wh.Equals(new ManualResetEvent(true));
+ rValue = 4;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (wh.Equals(new ManualResetEvent()))");
+ }
+
+ try {
+ wh.GetHashCode();
+ rValue = 5;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (wh.GetHasCode())");
+ }
+
+ // try {
+ // wh.GetLifetimeService();
+ // rValue = 6;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (wh.GetLifetimeService())");
+ // }
+
+ try {
+ wh.GetType();
+ rValue = 7;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (wh.GetType())");
+ }
+
+ // try {
+ // wh.InitializeLifetimeService();
+ // rValue = 8;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (wh.InitializeLifeTimeService())");
+ // }
+
+ try {
+ wh.ToString();
+ rValue = 11;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (wh.ToString())");
+ }
+
+ try {
+ wh.WaitOne();
+ rValue = 12;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (wh.WaitOne())");
+ }
+
+ try {
+ wh.WaitOne(1000);//,true);
+ rValue = 13;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (wh.WaitOne(int))");
+ }
+
+ // try {
+ // wh.WaitOne(1000,false);
+ // rValue = 14;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (wh.WaitOne(int,bool))");
+ // }
+
+ try {
+ wh.WaitOne(new TimeSpan(1000));//,true);
+ rValue = 15;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (wh.WaitOne(TimeSpan,bool))");
+ }
+
+ // try {
+ // wh.WaitOne(new TimeSpan(1000),false);
+ // rValue = 16;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (wh.WaitOne(TimeSpan,bool))");
+ // }
+
+ Console.WriteLine("Return Code == {0}",rValue);
+ return rValue;
+ }
+}
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_WHNullRefEx.csproj b/tests/src/baseservices/threading/coverage/Nullref/CS_WHNullRefEx.csproj
new file mode 100644
index 0000000000..e7cbf278c3
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_WHNullRefEx.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CS_WHNullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/currentculture/CultureChangeSecurity.csproj b/tests/src/baseservices/threading/currentculture/CultureChangeSecurity.csproj
new file mode 100644
index 0000000000..c0cf32c8e6
--- /dev/null
+++ b/tests/src/baseservices/threading/currentculture/CultureChangeSecurity.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="culturechangesecurity.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/currentculture/culturechangesecurity.cs b/tests/src/baseservices/threading/currentculture/culturechangesecurity.cs
new file mode 100644
index 0000000000..50d127ae31
--- /dev/null
+++ b/tests/src/baseservices/threading/currentculture/culturechangesecurity.cs
@@ -0,0 +1,62 @@
+// 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.Threading;
+using System.Globalization;
+
+public class CultureChangeSecurity
+{
+ public static int Main(string[] args)
+ {
+ bool status = true;
+
+ status &= Scenario1();
+ status &= Scenario2();
+
+ if (!status)
+ {
+ Console.WriteLine("Test Failed");
+ return 101;
+ }
+ else
+ {
+ Console.WriteLine("Test Passed!");
+ return 100;
+ }
+ }
+
+ public static bool Scenario1()
+ {
+ Console.WriteLine("Scenario1: Ensure user code can access Globalization.CultureInfo.CurrentCulture");
+
+ try
+ {
+ CultureInfo ci = System.Globalization.CultureInfo.CurrentCulture;
+ return true;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Fail - Got unexpected Exception: " + e);
+ return false;
+ }
+ }
+
+ public static bool Scenario2()
+ {
+ Console.WriteLine("Scenario2: Ensure user code can access Globalization.CultureInfo.CurrentUICulture");
+
+ try
+ {
+ CultureInfo ci = System.Globalization.CultureInfo.CurrentUICulture;
+ return true;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Fail - Got unexpected Exception: " + e);
+ return false;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/delegate/BeginInvokeEndInvoke.cs b/tests/src/baseservices/threading/delegate/BeginInvokeEndInvoke.cs
new file mode 100644
index 0000000000..c806f516c4
--- /dev/null
+++ b/tests/src/baseservices/threading/delegate/BeginInvokeEndInvoke.cs
@@ -0,0 +1,58 @@
+// 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.Threading;
+
+namespace DelegateTest
+{
+ class DelegateCommon
+ {
+ public static string TestMethod(int input)
+ {
+ return input.ToString();
+ }
+ }
+
+ class BeginInvokeEndInvokeTest
+ {
+ public delegate string AsyncMethodCaller(int input);
+ static int Main(string[] args)
+ {
+ IAsyncResult result = null;
+ AsyncMethodCaller caller = new AsyncMethodCaller(DelegateCommon.TestMethod);
+
+ try
+ {
+ result = caller.BeginInvoke(123, null, null);
+ }
+ catch (PlatformNotSupportedException)
+ {
+ // Expected
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("BeginInvoke resulted in unexpected exception: {0}", ex.ToString());
+ Console.WriteLine("FAILED!");
+ return -1;
+ }
+
+ try
+ {
+ caller.EndInvoke(result);
+ }
+ catch (PlatformNotSupportedException)
+ {
+ // Expected
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("EndInvoke resulted in unexpected exception: {0}", ex.ToString());
+ Console.WriteLine("FAILED!");
+ return -1;
+ }
+
+ return 100;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/delegate/BeginInvokeEndInvoke.csproj b/tests/src/baseservices/threading/delegate/BeginInvokeEndInvoke.csproj
new file mode 100644
index 0000000000..b321aac7ca
--- /dev/null
+++ b/tests/src/baseservices/threading/delegate/BeginInvokeEndInvoke.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{c485e164-f82c-4a4f-a02e-bc711827e5be}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="BeginInvokeEndInvoke.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/AutoResetEvent/ConstructFalse.cs b/tests/src/baseservices/threading/events/AutoResetEvent/ConstructFalse.cs
new file mode 100644
index 0000000000..7901f9018c
--- /dev/null
+++ b/tests/src/baseservices/threading/events/AutoResetEvent/ConstructFalse.cs
@@ -0,0 +1,68 @@
+// 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.Threading;
+using System.Diagnostics;
+
+public class ARETestClass
+{
+
+ public static int Main()
+ {
+ ARETestClass testAutoReset = new ARETestClass();
+ int ret = testAutoReset.Run();
+ Console.WriteLine(ret == 100 ? "Test Passed":"Test Failed");
+ return ret;
+ }
+
+ public int Run()
+ {
+ Stopwatch sw = new Stopwatch();
+ AutoResetEvent are = new AutoResetEvent(false);
+ sw.Start();
+ bool ret = are.WaitOne(1000);//,false);
+ sw.Stop();
+ //We should never get signaled
+ if(ret)
+ {
+ Console.WriteLine("AutoResetEvent should never be signalled.");
+ return -1;
+ }
+
+ if(sw.ElapsedMilliseconds < 900)
+ {
+ Console.WriteLine("It should take at least 900 milliseconds to call bool ret = are.WaitOne(1000,false);.");
+ Console.WriteLine("sw.ElapsedMilliseconds = " + sw.ElapsedMilliseconds);
+ return -2;
+ }
+
+ are.Set();
+ if(!are.WaitOne(0))//,false))
+ {
+ Console.WriteLine("Signalled event should always return true on call to !are.WaitOne(0,false).");
+ return -3;
+ }
+
+ sw.Reset();
+ sw.Start();
+ ret = are.WaitOne(1000);//,false);
+ sw.Stop();
+ //We should never get signaled
+ if(ret)
+ {
+ Console.WriteLine("AutoResetEvent should never be signalled after is is AutoReset.");
+ return -4;
+ }
+
+ if(sw.ElapsedMilliseconds < 900)
+ {
+ Console.WriteLine("It should take at least 900 milliseconds to call bool ret = are.WaitOne(1000,false);.");
+ Console.WriteLine("sw.ElapsedMilliseconds = " + sw.ElapsedMilliseconds);
+ return -5;
+ }
+
+ return 100;
+
+ }
+}
diff --git a/tests/src/baseservices/threading/events/AutoResetEvent/ConstructFalse.csproj b/tests/src/baseservices/threading/events/AutoResetEvent/ConstructFalse.csproj
new file mode 100644
index 0000000000..2fadb91930
--- /dev/null
+++ b/tests/src/baseservices/threading/events/AutoResetEvent/ConstructFalse.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{1de36f31-ddef-43ff-a8e8-e09f11711c13}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ConstructFalse.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/AutoResetEvent/ConstructTrue.cs b/tests/src/baseservices/threading/events/AutoResetEvent/ConstructTrue.cs
new file mode 100644
index 0000000000..161bc352ce
--- /dev/null
+++ b/tests/src/baseservices/threading/events/AutoResetEvent/ConstructTrue.cs
@@ -0,0 +1,50 @@
+// 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.Threading;
+using System.Diagnostics;
+
+public class ARETestClass
+{
+
+ public static int Main()
+ {
+ ARETestClass testAutoReset = new ARETestClass();
+
+ int ret = testAutoReset.Run();
+ Console.WriteLine(ret == 100 ? "Test Passed":"Test Failed");
+ return ret;
+ }
+
+ public int Run()
+ {
+ AutoResetEvent are = new AutoResetEvent(true);
+ Stopwatch sw = new Stopwatch();
+
+ if(!are.WaitOne(0))//,false))
+{
+ Console.WriteLine("Signalled event should always return true on call to !are.WaitOne(0,false).");
+ return -3;
+ }
+
+ sw.Start();
+ bool ret = are.WaitOne(1000);//,false);
+ sw.Stop();
+ //We should never get signaled
+ if(ret)
+ {
+ Console.WriteLine("AutoResetEvent should never be signalled.");
+ return -1;
+ }
+
+ if(sw.ElapsedMilliseconds < 900)
+ {
+ Console.WriteLine("It should take at least 900 milliseconds to call bool ret = are.WaitOne(1000,false);.");
+ Console.WriteLine("sw.ElapsedMilliseconds = " + sw.ElapsedMilliseconds);
+ return -2;
+ }
+ return 100;
+
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/AutoResetEvent/ConstructTrue.csproj b/tests/src/baseservices/threading/events/AutoResetEvent/ConstructTrue.csproj
new file mode 100644
index 0000000000..b87f2ccf73
--- /dev/null
+++ b/tests/src/baseservices/threading/events/AutoResetEvent/ConstructTrue.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{1de36f31-ddef-43ff-a8e8-e09f11711c13}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ConstructTrue.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast1.cs b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast1.cs
new file mode 100644
index 0000000000..3224b6960a
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast1.cs
@@ -0,0 +1,45 @@
+// 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.Threading;
+
+class AutoResetCtor
+{
+ EventWaitHandle ewh;
+
+ public static int Main()
+ {
+ AutoResetCtor arc = new AutoResetCtor();
+ return arc.Run();
+ }
+
+ private int Run()
+ {
+ // Testing the initialState = true for an AutoResetEvent
+ int iRet = -1;
+ ewh = (EventWaitHandle)new AutoResetEvent(true);
+
+ Thread t = new Thread(new ThreadStart(ThreadWorker));
+ t.Start();
+ t.Join();
+
+ // when doing another wait, it should not return until set.
+ Console.WriteLine("Main: Waiting...");
+ bool b = ewh.WaitOne(5000);//, false);
+ if(b)
+ Console.WriteLine("WaitOne didn't reset!");
+ else
+ iRet = 100;
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void ThreadWorker()
+ {
+ Console.WriteLine("TW: Waiting...");
+ // This should return immediately
+ ewh.WaitOne();
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast1.csproj b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast1.csproj
new file mode 100644
index 0000000000..a09f3f2812
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast1.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AutoResetCast1.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast2.cs b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast2.cs
new file mode 100644
index 0000000000..ffb535b504
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast2.cs
@@ -0,0 +1,50 @@
+// 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.Threading;
+
+class AutoResetCtor
+{
+ EventWaitHandle ewh;
+ int iRet = -1;
+
+ public static int Main()
+ {
+ AutoResetCtor arc = new AutoResetCtor();
+ return arc.Run();
+ }
+
+ private int Run()
+ {
+ // Testing the initialState = false for an AutoResetEvent
+ ewh = (EventWaitHandle)new AutoResetEvent(false);
+
+ Thread t = new Thread(new ThreadStart(ThreadWorker));
+ t.Start();
+ t.Join();
+
+ ewh.Set();
+ // when doing another wait, it should return immediately
+ Console.WriteLine("Main: Waiting...");
+ bool b = ewh.WaitOne(5000);//, false);
+ if(b)
+ iRet += 50;
+ else
+ Console.WriteLine("WaitOne() timed out");
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void ThreadWorker()
+ {
+ Console.WriteLine("TW: Waiting...");
+ // This should NOT return immediately
+ bool b = ewh.WaitOne(5000);//, false);
+ if(b)
+ Console.WriteLine("WaitOne returned successful");
+ else
+ iRet = 50;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast2.csproj b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast2.csproj
new file mode 100644
index 0000000000..4f9e6c6aa0
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast2.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AutoResetCast2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor1.cs b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor1.cs
new file mode 100644
index 0000000000..779ef65f99
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor1.cs
@@ -0,0 +1,45 @@
+// 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.Threading;
+
+class AutoResetCtor
+{
+ EventWaitHandle ewh;
+
+ public static int Main()
+ {
+ AutoResetCtor arc = new AutoResetCtor();
+ return arc.Run();
+ }
+
+ private int Run()
+ {
+ // Testing the initialState = true for an AutoResetEvent
+ int iRet = -1;
+ ewh = new EventWaitHandle(true, EventResetMode.AutoReset);
+
+ Thread t = new Thread(new ThreadStart(ThreadWorker));
+ t.Start();
+ t.Join();
+
+ // when doing another wait, it should not return until set.
+ Console.WriteLine("Main: Waiting...");
+ bool b = ewh.WaitOne(5000);//, false);
+ if(b)
+ Console.WriteLine("WaitOne didn't reset!");
+ else
+ iRet = 100;
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void ThreadWorker()
+ {
+ Console.WriteLine("TW: Waiting...");
+ // This should return immediately
+ ewh.WaitOne();
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor1.csproj b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor1.csproj
new file mode 100644
index 0000000000..0a5de27e60
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor1.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AutoResetCtor1.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor2.cs b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor2.cs
new file mode 100644
index 0000000000..e86187a786
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor2.cs
@@ -0,0 +1,50 @@
+// 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.Threading;
+
+class AutoResetCtor
+{
+ EventWaitHandle ewh;
+ int iRet = -1;
+
+ public static int Main()
+ {
+ AutoResetCtor arc = new AutoResetCtor();
+ return arc.Run();
+ }
+
+ private int Run()
+ {
+ // Testing the initialState = false for an AutoResetEvent
+ ewh = new EventWaitHandle(false, EventResetMode.AutoReset);
+
+ Thread t = new Thread(new ThreadStart(ThreadWorker));
+ t.Start();
+ t.Join();
+
+ ewh.Set();
+ // when doing another wait, it should return immediately
+ Console.WriteLine("Main: Waiting...");
+ bool b = ewh.WaitOne(5000);//, false);
+ if(b)
+ iRet += 50;
+ else
+ Console.WriteLine("WaitOne() timed out");
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void ThreadWorker()
+ {
+ Console.WriteLine("TW: Waiting...");
+ // This should NOT return immediately
+ bool b = ewh.WaitOne(5000);//, false);
+ if(b)
+ Console.WriteLine("WaitOne returned successful");
+ else
+ iRet = 50;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor2.csproj b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor2.csproj
new file mode 100644
index 0000000000..31949252ea
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor2.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AutoResetCtor2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast1.cs b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast1.cs
new file mode 100644
index 0000000000..dc96ebc061
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast1.cs
@@ -0,0 +1,47 @@
+// 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.Threading;
+
+class ManualResetCtor
+{
+ EventWaitHandle ewh;
+
+ public static int Main()
+ {
+ ManualResetCtor mrc = new ManualResetCtor();
+ return mrc.Run();
+ }
+
+ private int Run()
+ {
+ // Testing the initialState = true for a ManualResetEvent
+ int iRet = -1;
+ ewh = (EventWaitHandle)new ManualResetEvent(true);
+
+ Thread t = new Thread(new ThreadStart(ThreadWorker));
+ t.Start();
+ t.Join();
+
+ // This should return immediately
+ ewh.WaitOne();
+ ewh.Reset();
+
+ // when doing another wait, it should not return until set.
+ bool b = ewh.WaitOne(5000);//, false);
+ if(b)
+ Console.WriteLine("Event didn't reset!");
+ else
+ iRet = 100;
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void ThreadWorker()
+ {
+ // This should return immediately
+ ewh.WaitOne();
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast1.csproj b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast1.csproj
new file mode 100644
index 0000000000..1519cd461b
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast1.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ManualResetCast1.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast2.cs b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast2.cs
new file mode 100644
index 0000000000..51723a920c
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast2.cs
@@ -0,0 +1,48 @@
+// 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.Threading;
+
+class ManualResetCtor
+{
+ EventWaitHandle ewh;
+ int iRet = -1;
+
+ public static int Main()
+ {
+ ManualResetCtor mrc = new ManualResetCtor();
+ return mrc.Run();
+ }
+
+ private int Run()
+ {
+ // Testing the initialState = false for a ManualResetEvent
+ ewh = (EventWaitHandle)new ManualResetEvent(false);
+
+ Thread t = new Thread(new ThreadStart(ThreadWorker));
+ t.Start();
+ t.Join();
+
+ ewh.Set();
+ // when doing another wait, it should return immediately
+ bool b = ewh.WaitOne(5000);//, false);
+ if(b)
+ iRet += 50;
+ else
+ Console.WriteLine("WaitOne() timed out");
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void ThreadWorker()
+ {
+ // This should NOT return immediately
+ bool b = ewh.WaitOne(5000);//, false);
+ if(b)
+ Console.WriteLine("WaitOne returned successful");
+ else
+ iRet = 50;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast2.csproj b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast2.csproj
new file mode 100644
index 0000000000..56218ee5a1
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast2.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ManualResetCast2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor1.cs b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor1.cs
new file mode 100644
index 0000000000..ea4e6fe9a1
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor1.cs
@@ -0,0 +1,47 @@
+// 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.Threading;
+
+class ManualResetCtor
+{
+ EventWaitHandle ewh;
+
+ public static int Main()
+ {
+ ManualResetCtor mrc = new ManualResetCtor();
+ return mrc.Run();
+ }
+
+ private int Run()
+ {
+ // Testing the initialState = true for a ManualResetEvent
+ int iRet = -1;
+ ewh = new EventWaitHandle(true, EventResetMode.ManualReset);
+
+ Thread t = new Thread(new ThreadStart(ThreadWorker));
+ t.Start();
+ t.Join();
+
+ // This should return immediately
+ ewh.WaitOne();
+ ewh.Reset();
+
+ // when doing another wait, it should not return until set.
+ bool b = ewh.WaitOne(5000);//, false);
+ if(b)
+ Console.WriteLine("Event didn't reset!");
+ else
+ iRet = 100;
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void ThreadWorker()
+ {
+ // This should return immediately
+ ewh.WaitOne();
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor1.csproj b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor1.csproj
new file mode 100644
index 0000000000..b021cbfde7
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor1.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ManualResetCtor1.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor2.cs b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor2.cs
new file mode 100644
index 0000000000..8100201f1a
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor2.cs
@@ -0,0 +1,48 @@
+// 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.Threading;
+
+class ManualResetCtor
+{
+ EventWaitHandle ewh;
+ int iRet = -1;
+
+ public static int Main()
+ {
+ ManualResetCtor mrc = new ManualResetCtor();
+ return mrc.Run();
+ }
+
+ private int Run()
+ {
+ // Testing the initialState = false for a ManualResetEvent
+ ewh = new EventWaitHandle(false, EventResetMode.ManualReset);
+
+ Thread t = new Thread(new ThreadStart(ThreadWorker));
+ t.Start();
+ t.Join();
+
+ ewh.Set();
+ // when doing another wait, it should return immediately
+ bool b = ewh.WaitOne(5000);//, false);
+ if(b)
+ iRet += 50;
+ else
+ Console.WriteLine("WaitOne() timed out");
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void ThreadWorker()
+ {
+ // This should NOT return immediately
+ bool b = ewh.WaitOne(5000);//, false);
+ if(b)
+ Console.WriteLine("WaitOne returned successful");
+ else
+ iRet = 50;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor2.csproj b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor2.csproj
new file mode 100644
index 0000000000..8ed2e235d0
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor2.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ManualResetCtor2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/NamedCommon.cs b/tests/src/baseservices/threading/events/EventWaitHandle/NamedCommon.cs
new file mode 100644
index 0000000000..075f1ebafc
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/NamedCommon.cs
@@ -0,0 +1,35 @@
+// 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.Threading;
+
+class Common
+{
+ public static string GenerateUnicodeString(int iNumChars)
+ {
+ Random rand = new Random();
+ string semName = string.Empty;
+ string semNameNum = string.Empty;
+ for (int i = 0; i < iNumChars; i++)
+ {
+ char c = '\\';
+ while (c == '\\')
+ {
+ c = (char)rand.Next(Char.MinValue, Char.MaxValue);
+ }
+ semNameNum += ((int)c).ToString() + ";";
+ semName += c;
+ }
+ // write to output
+ Console.WriteLine("Unicode string: " + semNameNum);
+ return semName;
+ }
+
+ public static string GetUniqueName()
+ {
+ string sName = Guid.NewGuid().ToString();
+ Console.WriteLine("Name created: " + sName);
+ return sName;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructFalse.cs b/tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructFalse.cs
new file mode 100644
index 0000000000..2ea6f7eadb
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructFalse.cs
@@ -0,0 +1,35 @@
+// 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.Threading;
+using System.Diagnostics;
+
+public class AutoConstructFalse : EventWaitHandleTest
+{
+ public static int Main()
+ {
+ return RunTest(new Func<int>(Run));
+ }
+
+ public static int Run()
+ {
+ var sw = new Stopwatch();
+ var ewh = new EventWaitHandle(false, System.Threading.EventResetMode.AutoReset);
+
+ // Should not signal
+ if (ewh.TestWaitOne(1000, sw))
+ return -1;
+
+ // Should signal
+ ewh.Set();
+ if (!ewh.TestWaitOne(0, null))
+ return -2;
+
+ // Should not signal
+ if (ewh.TestWaitOne(1000, sw))
+ return -3;
+
+ return TestPassed;
+ }
+}
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructFalse.csproj b/tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructFalse.csproj
new file mode 100644
index 0000000000..38a38316dc
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructFalse.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{7e4cd64f-c8d1-491c-bf2e-72f841ec6813}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AutoConstructFalse.cs" />
+ <Compile Include="EventWaitHandleTest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructTrue.cs b/tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructTrue.cs
new file mode 100644
index 0000000000..94b99044ac
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructTrue.cs
@@ -0,0 +1,28 @@
+// 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.Threading;
+using System.Diagnostics;
+
+public class AutoConstructTrue : EventWaitHandleTest
+{
+ public static int Main()
+ {
+ return RunTest(new Func<int>(Run));
+ }
+
+ public static int Run()
+ {
+ var ewh = new EventWaitHandle(true, EventResetMode.AutoReset);
+ var sw = new Stopwatch();
+
+ if (!ewh.TestWaitOne(0, null))
+ return -1;
+
+ if (ewh.TestWaitOne(1000, sw))
+ return -2;
+
+ return TestPassed;
+ }
+}
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructTrue.csproj b/tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructTrue.csproj
new file mode 100644
index 0000000000..ccbb8e1738
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructTrue.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{7e4cd64f-c8d1-491c-bf2e-72f841ec6813}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AutoConstructTrue.cs" />
+ <Compile Include="EventWaitHandleTest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/unit/EventWaitHandleTest.cs b/tests/src/baseservices/threading/events/EventWaitHandle/unit/EventWaitHandleTest.cs
new file mode 100644
index 0000000000..3e2ee1dcd1
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/unit/EventWaitHandleTest.cs
@@ -0,0 +1,60 @@
+// 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.Threading;
+using System.Diagnostics;
+
+public class EventWaitHandleTest
+{
+ public const int TestPassed = 100; // Returned by Run() on success
+
+ public static int RunTest(Func<int> test) {
+ var rv = test();
+ Console.WriteLine(rv == TestPassed ? "Test passed" : "Test failed");
+ return rv;
+ }
+
+ public static bool TryOpenExisting<Expected>(string name) where Expected : Exception
+ {
+ EventWaitHandle ewh;
+ return TryOpenExisting<Expected>(name, out ewh);
+ }
+
+ public static bool TryOpenExisting<Expected>(string name, out EventWaitHandle ewh) where Expected : Exception
+ {
+ ewh = null;
+ try {
+ ewh = EventWaitHandle.OpenExisting(name);
+ } catch (Expected) {
+ } catch (Exception ne) {
+ Console.WriteLine("Caught unexpected exception: {0}", ne);
+ return false;
+ }
+ return true;
+ }
+
+ public class NoException : Exception {}
+}
+
+public static class EventWaitHandleExtensions
+{
+ const int FudgeFactor = 100; // Account for timing uncertainties
+
+ public static bool TestWaitOne(this EventWaitHandle ewh, int timeout, Stopwatch sw)
+ {
+ if (timeout == 0)
+ return ewh.WaitOne();
+
+ if (sw == null)
+ sw = new Stopwatch();
+ else
+ sw.Reset();
+
+ sw.Start();
+ bool signaled = ewh.WaitOne(timeout);
+ sw.Stop();
+
+ return signaled || sw.ElapsedMilliseconds < timeout - FudgeFactor;
+ }
+}
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructFalse.cs b/tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructFalse.cs
new file mode 100644
index 0000000000..459fe95b7f
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructFalse.cs
@@ -0,0 +1,36 @@
+// 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.Threading;
+using System.Diagnostics;
+
+public class ManualConstructFalse : EventWaitHandleTest
+{
+ public static int Main()
+ {
+ return RunTest(new Func<int>(Run));
+ }
+
+ public static int Run()
+ {
+ var sw = new Stopwatch();
+ var ewh = new EventWaitHandle(false, EventResetMode.ManualReset);
+
+ // Should not signal
+ if (ewh.TestWaitOne(1000, sw))
+ return -1;
+
+ // Should signal
+ ewh.Set();
+ if (!ewh.TestWaitOne(0, sw))
+ return -2;
+
+ // Should not signal
+ ewh.Reset();
+ if (ewh.TestWaitOne(1000, sw))
+ return -3;
+
+ return TestPassed;
+ }
+}
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructFalse.csproj b/tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructFalse.csproj
new file mode 100644
index 0000000000..411351ccbf
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructFalse.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{7e4cd64f-c8d1-491c-bf2e-72f841ec6813}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ManualConstructFalse.cs" />
+ <Compile Include="EventWaitHandleTest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructTrue.cs b/tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructTrue.cs
new file mode 100644
index 0000000000..6cb314c4fa
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructTrue.cs
@@ -0,0 +1,34 @@
+// 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.Threading;
+
+public class ManualConstructTrue : EventWaitHandleTest
+{
+ public static int Main()
+ {
+ return RunTest(new Func<int>(Run));
+ }
+
+ public static int Run()
+ {
+ var ewh = new EventWaitHandle(true, EventResetMode.ManualReset);
+
+ // Should signal
+ if (!ewh.TestWaitOne(0, null))
+ return -1;
+
+ // Should not signal
+ ewh.Reset();
+ if (ewh.TestWaitOne(1000, null))
+ return -2;
+
+ // Should signal
+ ewh.Set();
+ if (!ewh.TestWaitOne(0, null))
+ return -3;
+
+ return TestPassed;
+ }
+}
diff --git a/tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructTrue.csproj b/tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructTrue.csproj
new file mode 100644
index 0000000000..3f17e72fbb
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructTrue.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{7e4cd64f-c8d1-491c-bf2e-72f841ec6813}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ManualConstructTrue.cs" />
+ <Compile Include="EventWaitHandleTest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/ManualResetEvent/ConstructFalse.cs b/tests/src/baseservices/threading/events/ManualResetEvent/ConstructFalse.cs
new file mode 100644
index 0000000000..ac4572799f
--- /dev/null
+++ b/tests/src/baseservices/threading/events/ManualResetEvent/ConstructFalse.cs
@@ -0,0 +1,58 @@
+// 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.Threading;
+using System.Diagnostics;
+
+public class MRETestClass
+{
+
+ public static int Main()
+ {
+ MRETestClass testManualReset = new MRETestClass();
+ int ret = testManualReset.Run();
+ Console.WriteLine(ret == 100 ? "Test Passed":"Test Failed");
+ return ret;
+ }
+
+ public int Run()
+ {
+ Stopwatch sw = new Stopwatch();
+ ManualResetEvent mre = new ManualResetEvent(false);
+ sw.Start();
+ bool ret = mre.WaitOne(1000);//,false);
+ sw.Stop();
+ //We should never get signaled
+ Console.WriteLine("Expect WaitOne to return False and time-out after 1000 milliseconds waiting for signal.");
+ Console.WriteLine("Actual return is: " + ret.ToString());
+ Console.WriteLine("Expect Stopwatch to use entire 1000 milliseconds.");
+ Console.WriteLine("Actual time taken is: " + sw.ElapsedMilliseconds.ToString());
+ Console.WriteLine();
+ if(ret || sw.ElapsedMilliseconds < 900)
+ return -1;
+ Console.WriteLine("Manual Reset Event signalled.");
+ mre.Set();
+ ret = mre.WaitOne(0);//,false);
+ Console.WriteLine("Expect WaitOne to return True and time-out after 1000 milliseconds waiting for signal.");
+ Console.WriteLine("Actual return is: " + ret.ToString());
+ Console.WriteLine();
+ if(!ret)
+ return -3;
+ mre.Reset();
+ sw.Reset();
+ sw.Start();
+ ret = mre.WaitOne(1000);//,false);
+ sw.Stop();
+ //We should never get signaled
+ Console.WriteLine("Expect WaitOne to return false and time-out after 1000 milliseconds waiting for signal.");
+ Console.WriteLine("Actual return is: " + ret.ToString());
+ Console.WriteLine("Expect Stopwatch to use entire 1000 milliseconds.");
+ Console.WriteLine("Actual time taken is: " + sw.ElapsedMilliseconds.ToString());
+ if(ret || sw.ElapsedMilliseconds < 900)
+ return -1;
+
+ return 100;
+
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/ManualResetEvent/ConstructFalse.csproj b/tests/src/baseservices/threading/events/ManualResetEvent/ConstructFalse.csproj
new file mode 100644
index 0000000000..9cfd959502
--- /dev/null
+++ b/tests/src/baseservices/threading/events/ManualResetEvent/ConstructFalse.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{717a283b-e0af-4ef2-b072-0378decb2d96}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ConstructFalse.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/ManualResetEvent/ConstructTrue.cs b/tests/src/baseservices/threading/events/ManualResetEvent/ConstructTrue.cs
new file mode 100644
index 0000000000..ab2b09a5fa
--- /dev/null
+++ b/tests/src/baseservices/threading/events/ManualResetEvent/ConstructTrue.cs
@@ -0,0 +1,36 @@
+// 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.Threading;
+
+public class MRETestClass
+{
+
+ public static int Main()
+ {
+ MRETestClass testManualReset = new MRETestClass();
+
+ int ret = testManualReset.Run();
+ Console.WriteLine(ret == 100 ? "Test Passed":"Test Failed");
+ return ret;
+ }
+
+ public int Run()
+ {
+ ManualResetEvent mre = new ManualResetEvent(true);
+
+ if(!mre.WaitOne(0))//,false)) //are.WaitOne returns true if signaled
+ return -1;
+ mre.Reset();
+ if(mre.WaitOne(1000))//,false))
+ return -3;
+ mre.Set();
+ if(mre.WaitOne(0))//,false))
+ return 100;
+
+ Console.WriteLine("ManualResetEvent Broken");
+ return -3;
+
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/events/ManualResetEvent/ConstructTrue.csproj b/tests/src/baseservices/threading/events/ManualResetEvent/ConstructTrue.csproj
new file mode 100644
index 0000000000..46990bf365
--- /dev/null
+++ b/tests/src/baseservices/threading/events/ManualResetEvent/ConstructTrue.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{717a283b-e0af-4ef2-b072-0378decb2d96}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ConstructTrue.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit01.cs b/tests/src/baseservices/threading/generics/Monitor/EnterExit01.cs
new file mode 100644
index 0000000000..9247770519
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit01.cs
@@ -0,0 +1,94 @@
+// 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.Threading;
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+class Gen<T>
+{
+ public static void EnterExitTest()
+ {
+ Type monitor = typeof(Gen<T>);
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ // MonitorDelegate[] consumer = new MonitorDelegate[Test.nThreads];
+ // for(int i=0;i<consumer.Length;i++){
+ // consumer[i] = new MonitorDelegate(myHelper.Consumer);
+ // consumer[i].BeginInvoke(monitor,null,null);
+ // }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.Consumer(monitor);
+ });
+ }
+
+ for(int i=0;i<6;i++){
+ if(myHelper.m_Event.WaitOne(10000))//,true))
+ break;
+ if(myHelper.Error == true)
+ break;
+ }
+ Test.Eval(!myHelper.Error);
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 10;
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+ }
+
+ public static int Main()
+ {
+ Gen<int>.EnterExitTest();
+ Gen<double>.EnterExitTest();
+ Gen<string>.EnterExitTest();
+ Gen<object>.EnterExitTest();
+ Gen<Guid>.EnterExitTest();
+
+ Gen<int[]>.EnterExitTest();
+ Gen<double[,]>.EnterExitTest();
+ Gen<string[][][]>.EnterExitTest();
+ Gen<object[,,,]>.EnterExitTest();
+ Gen<Guid[][,,,][]>.EnterExitTest();
+
+ Gen<RefX1<int>[]>.EnterExitTest();
+ Gen<RefX1<double>[,]>.EnterExitTest();
+ Gen<RefX1<string>[][][]>.EnterExitTest();
+ Gen<RefX1<object>[,,,]>.EnterExitTest();
+ Gen<RefX1<Guid>[][,,,][]>.EnterExitTest();
+
+ Gen<ValX1<int>[]>.EnterExitTest();
+ Gen<ValX1<double>[,]>.EnterExitTest();
+ Gen<ValX1<string>[][][]>.EnterExitTest();
+ Gen<ValX1<object>[,,,]>.EnterExitTest();
+ Gen<ValX1<Guid>[][,,,][]>.EnterExitTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit01.csproj b/tests/src/baseservices/threading/generics/Monitor/EnterExit01.csproj
new file mode 100644
index 0000000000..bd17304850
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit01.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EnterExit01.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit02.cs b/tests/src/baseservices/threading/generics/Monitor/EnterExit02.cs
new file mode 100644
index 0000000000..2409bc9d23
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit02.cs
@@ -0,0 +1,167 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+class Gen<T>
+{
+ public static void EnterExitTest<U>()
+ {
+ Type monitorT = typeof(Gen<T>);
+ Type monitorU = typeof(Gen<U>);
+
+ if(monitorU.Equals(monitorT))
+ throw new Exception("Invalid use of test case, T must not be equal to U - POSSIBLE TYPE SYSTEM BUG");
+
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ TestHelper myHelper2 = new TestHelper(Test.nThreads);
+ WaitHandle[] myWaiter = new WaitHandle[2];
+ myWaiter[0] = myHelper.m_Event;
+ myWaiter[1] = myHelper2.m_Event;
+
+ for(int i=0;i<Test.nThreads;i++)
+ {
+ // new MonitorDelegate(myHelper.Consumer).BeginInvoke(monitorT,null,null);
+ // new MonitorDelegate(myHelper2.Consumer).BeginInvoke(monitorU,null,null);
+
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.Consumer(monitorT);
+ });
+
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper2.Consumer(monitorU);
+ });
+ }
+
+ for(int i=0;i<6;i++)
+ {
+ if(WaitHandle.WaitAll(myWaiter,10000))//,true))
+ break;
+ if(myHelper.Error == true || myHelper2.Error == true)
+ break;
+ }
+ Test.Eval(!(myHelper.Error && myHelper2.Error));
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 10;
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<double>.EnterExitTest<int>();
+ Gen<string>.EnterExitTest<int>();
+ Gen<object>.EnterExitTest<int>();
+ Gen<Guid>.EnterExitTest<int>();
+ Gen<RefX1<int>>.EnterExitTest<int>();
+ Gen<RefX1<string>>.EnterExitTest<int>();
+ Gen<ValX1<int>>.EnterExitTest<int>();
+ Gen<ValX1<string>>.EnterExitTest<int>();
+
+ Gen<int>.EnterExitTest<double>();
+ Gen<string>.EnterExitTest<double>();
+ Gen<object>.EnterExitTest<double>();
+ Gen<Guid>.EnterExitTest<double>();
+ Gen<RefX1<int>>.EnterExitTest<double>();
+ Gen<RefX1<string>>.EnterExitTest<double>();
+ Gen<ValX1<int>>.EnterExitTest<double>();
+ Gen<ValX1<string>>.EnterExitTest<double>();
+
+ Gen<int>.EnterExitTest<string>();
+ Gen<double>.EnterExitTest<string>();
+ Gen<object>.EnterExitTest<string>();
+ Gen<Guid>.EnterExitTest<string>();
+ Gen<RefX1<int>>.EnterExitTest<string>();
+ Gen<RefX1<string>>.EnterExitTest<string>();
+ Gen<ValX1<int>>.EnterExitTest<string>();
+ Gen<ValX1<string>>.EnterExitTest<string>();
+
+ Gen<int>.EnterExitTest<object>();
+ Gen<double>.EnterExitTest<object>();
+ Gen<string>.EnterExitTest<object>();
+ Gen<Guid>.EnterExitTest<object>();
+ Gen<RefX1<int>>.EnterExitTest<object>();
+ Gen<RefX1<string>>.EnterExitTest<object>();
+ Gen<ValX1<int>>.EnterExitTest<object>();
+ Gen<ValX1<string>>.EnterExitTest<object>();
+
+ Gen<int>.EnterExitTest<Guid>();
+ Gen<double>.EnterExitTest<Guid>();
+ Gen<string>.EnterExitTest<Guid>();
+ Gen<object>.EnterExitTest<Guid>();
+ Gen<RefX1<int>>.EnterExitTest<Guid>();
+ Gen<RefX1<string>>.EnterExitTest<Guid>();
+ Gen<ValX1<int>>.EnterExitTest<Guid>();
+ Gen<ValX1<string>>.EnterExitTest<Guid>();
+
+ Gen<int>.EnterExitTest<RefX1<int>>();
+ Gen<double>.EnterExitTest<RefX1<int>>();
+ Gen<string>.EnterExitTest<RefX1<int>>();
+ Gen<object>.EnterExitTest<RefX1<int>>();
+ Gen<Guid>.EnterExitTest<RefX1<int>>();
+ Gen<RefX1<string>>.EnterExitTest<RefX1<int>>();
+ Gen<ValX1<int>>.EnterExitTest<RefX1<int>>();
+ Gen<ValX1<string>>.EnterExitTest<RefX1<int>>();
+
+ Gen<int>.EnterExitTest<RefX1<string>>();
+ Gen<double>.EnterExitTest<RefX1<string>>();
+ Gen<string>.EnterExitTest<RefX1<string>>();
+ Gen<object>.EnterExitTest<RefX1<string>>();
+ Gen<Guid>.EnterExitTest<RefX1<string>>();
+ Gen<RefX1<int>>.EnterExitTest<RefX1<string>>();
+ Gen<ValX1<int>>.EnterExitTest<RefX1<string>>();
+ Gen<ValX1<string>>.EnterExitTest<RefX1<string>>();
+
+ Gen<int>.EnterExitTest<ValX1<int>>();
+ Gen<double>.EnterExitTest<ValX1<int>>();
+ Gen<string>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<object>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<Guid>.EnterExitTest<ValX1<int>>();
+ Gen<RefX1<int>>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<RefX1<string>>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<ValX1<string>>.EnterExitTest<ValX1<int>>(); //offending line
+
+ Gen<int>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<double>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<string>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<object>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<Guid>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<RefX1<int>>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<RefX1<string>>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<ValX1<int>>.EnterExitTest<ValX1<string>>(); //offending line
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit02.csproj b/tests/src/baseservices/threading/generics/Monitor/EnterExit02.csproj
new file mode 100644
index 0000000000..25068cd484
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit02.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EnterExit02.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit03.cs b/tests/src/baseservices/threading/generics/Monitor/EnterExit03.cs
new file mode 100644
index 0000000000..ed906b191d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit03.cs
@@ -0,0 +1,99 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+
+struct Gen<T>
+{
+ public static void EnterExitTest()
+ {
+ Type monitor = typeof(Gen<T>);
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ // MonitorDelegate[] consumer = new MonitorDelegate[Test.nThreads];
+ // for(int i=0;i<Test.nThreads;i++)
+ // {
+ // consumer[i] = new MonitorDelegate(myHelper.Consumer);
+ // consumer[i].BeginInvoke(monitor,null,null);
+ // }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.Consumer(monitor);
+ });
+ }
+
+ for(int i=0;i<6;i++)
+ {
+ if(myHelper.m_Event.WaitOne(10000))//,true))
+ break;
+ if(myHelper.Error == true)
+ break;
+ }
+ Test.Eval(!myHelper.Error);
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 10;
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.EnterExitTest();
+ Gen<double>.EnterExitTest();
+ Gen<string>.EnterExitTest();
+ Gen<object>.EnterExitTest();
+ Gen<Guid>.EnterExitTest();
+
+ Gen<int[]>.EnterExitTest();
+ Gen<double[,]>.EnterExitTest();
+ Gen<string[][][]>.EnterExitTest();
+ Gen<object[,,,]>.EnterExitTest();
+ Gen<Guid[][,,,][]>.EnterExitTest();
+
+ Gen<RefX1<int>[]>.EnterExitTest();
+ Gen<RefX1<double>[,]>.EnterExitTest();
+ Gen<RefX1<string>[][][]>.EnterExitTest();
+ Gen<RefX1<object>[,,,]>.EnterExitTest();
+ Gen<RefX1<Guid>[][,,,][]>.EnterExitTest();
+
+ Gen<ValX1<int>[]>.EnterExitTest();
+ Gen<ValX1<double>[,]>.EnterExitTest();
+ Gen<ValX1<string>[][][]>.EnterExitTest();
+ Gen<ValX1<object>[,,,]>.EnterExitTest();
+ Gen<ValX1<Guid>[][,,,][]>.EnterExitTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit03.csproj b/tests/src/baseservices/threading/generics/Monitor/EnterExit03.csproj
new file mode 100644
index 0000000000..59be5afa92
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit03.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EnterExit03.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit04.cs b/tests/src/baseservices/threading/generics/Monitor/EnterExit04.cs
new file mode 100644
index 0000000000..2c8225034a
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit04.cs
@@ -0,0 +1,172 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+
+struct Gen<T>
+{
+ public static void EnterExitTest<U>()
+ {
+ Type monitorT = typeof(Gen<T>);
+ Type monitorU = typeof(Gen<U>);
+
+ if(monitorU.Equals(monitorT))
+ throw new Exception("Invalid use of test case, T must not be equal to U - POSSIBLE TYPE SYSTEM BUG");
+
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ TestHelper myHelper2 = new TestHelper(Test.nThreads);
+ WaitHandle[] myWaiter = new WaitHandle[2];
+ myWaiter[0] = myHelper.m_Event;
+ myWaiter[1] = myHelper2.m_Event;
+
+ // for(int i=0;i<Test.nThreads;i++)
+ // {
+ // new MonitorDelegate(myHelper.Consumer).BeginInvoke(monitorT,null,null);
+ // new MonitorDelegate(myHelper2.Consumer).BeginInvoke(monitorU,null,null);
+ // }
+
+ for(int i=0; i<Test.nThreads; i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.Consumer(monitorT);
+ });
+
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper2.Consumer(monitorU);
+ });
+ }
+
+
+ for(int i=0;i<6;i++)
+ {
+ if(WaitHandle.WaitAll(myWaiter,10000))//,true))
+ break;
+ if(myHelper.Error == true || myHelper2.Error == true)
+ break;
+ }
+ Test.Eval(!(myHelper.Error && myHelper2.Error));
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 10;
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<double>.EnterExitTest<int>();
+ Gen<string>.EnterExitTest<int>();
+ Gen<object>.EnterExitTest<int>();
+ Gen<Guid>.EnterExitTest<int>();
+ Gen<RefX1<int>>.EnterExitTest<int>();
+ Gen<RefX1<string>>.EnterExitTest<int>();
+ Gen<ValX1<int>>.EnterExitTest<int>();
+ Gen<ValX1<string>>.EnterExitTest<int>();
+
+ Gen<int>.EnterExitTest<double>();
+ Gen<string>.EnterExitTest<double>();
+ Gen<object>.EnterExitTest<double>();
+ Gen<Guid>.EnterExitTest<double>();
+ Gen<RefX1<int>>.EnterExitTest<double>();
+ Gen<RefX1<string>>.EnterExitTest<double>();
+ Gen<ValX1<int>>.EnterExitTest<double>();
+ Gen<ValX1<string>>.EnterExitTest<double>();
+
+ Gen<int>.EnterExitTest<string>();
+ Gen<double>.EnterExitTest<string>();
+ Gen<object>.EnterExitTest<string>();
+ Gen<Guid>.EnterExitTest<string>();
+ Gen<RefX1<int>>.EnterExitTest<string>();
+ Gen<RefX1<string>>.EnterExitTest<string>();
+ Gen<ValX1<int>>.EnterExitTest<string>();
+ Gen<ValX1<string>>.EnterExitTest<string>();
+
+ Gen<int>.EnterExitTest<object>();
+ Gen<double>.EnterExitTest<object>();
+ Gen<string>.EnterExitTest<object>();
+ Gen<Guid>.EnterExitTest<object>();
+ Gen<RefX1<int>>.EnterExitTest<object>();
+ Gen<RefX1<string>>.EnterExitTest<object>();
+ Gen<ValX1<int>>.EnterExitTest<object>();
+ Gen<ValX1<string>>.EnterExitTest<object>();
+
+ Gen<int>.EnterExitTest<Guid>();
+ Gen<double>.EnterExitTest<Guid>();
+ Gen<string>.EnterExitTest<Guid>();
+ Gen<object>.EnterExitTest<Guid>();
+ Gen<RefX1<int>>.EnterExitTest<Guid>();
+ Gen<RefX1<string>>.EnterExitTest<Guid>();
+ Gen<ValX1<int>>.EnterExitTest<Guid>();
+ Gen<ValX1<string>>.EnterExitTest<Guid>();
+
+ Gen<int>.EnterExitTest<RefX1<int>>();
+ Gen<double>.EnterExitTest<RefX1<int>>();
+ Gen<string>.EnterExitTest<RefX1<int>>();
+ Gen<object>.EnterExitTest<RefX1<int>>();
+ Gen<Guid>.EnterExitTest<RefX1<int>>();
+ Gen<RefX1<string>>.EnterExitTest<RefX1<int>>();
+ Gen<ValX1<int>>.EnterExitTest<RefX1<int>>();
+ Gen<ValX1<string>>.EnterExitTest<RefX1<int>>();
+
+ Gen<int>.EnterExitTest<RefX1<string>>();
+ Gen<double>.EnterExitTest<RefX1<string>>();
+ Gen<string>.EnterExitTest<RefX1<string>>();
+ Gen<object>.EnterExitTest<RefX1<string>>();
+ Gen<Guid>.EnterExitTest<RefX1<string>>();
+ Gen<RefX1<int>>.EnterExitTest<RefX1<string>>();
+ Gen<ValX1<int>>.EnterExitTest<RefX1<string>>();
+ Gen<ValX1<string>>.EnterExitTest<RefX1<string>>();
+
+ Gen<int>.EnterExitTest<ValX1<int>>();
+ Gen<double>.EnterExitTest<ValX1<int>>();
+ Gen<string>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<object>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<Guid>.EnterExitTest<ValX1<int>>();
+ Gen<RefX1<int>>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<RefX1<string>>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<ValX1<string>>.EnterExitTest<ValX1<int>>(); //offending line
+
+ Gen<int>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<double>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<string>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<object>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<Guid>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<RefX1<int>>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<RefX1<string>>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<ValX1<int>>.EnterExitTest<ValX1<string>>(); //offending line
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit04.csproj b/tests/src/baseservices/threading/generics/Monitor/EnterExit04.csproj
new file mode 100644
index 0000000000..73dd371392
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit04.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EnterExit04.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit05.cs b/tests/src/baseservices/threading/generics/Monitor/EnterExit05.cs
new file mode 100644
index 0000000000..e203506d96
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit05.cs
@@ -0,0 +1,99 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+class Gen<T>
+{
+ public static void EnterExitTest()
+ {
+ Type monitor = typeof(Gen<T>).GetGenericTypeDefinition();
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+
+ // MonitorDelegate[] consumer = new MonitorDelegate[Test.nThreads];
+ // for(int i=0;i<Test.nThreads;i++)
+ // {
+ // consumer[i] = new MonitorDelegate(myHelper.Consumer);
+ // consumer[i].BeginInvoke(monitor,null,null);
+ // }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.Consumer(monitor);
+ });
+ }
+
+ for(int i=0;i<6;i++)
+ {
+ if(myHelper.m_Event.WaitOne(10000))//,true))
+ break;
+ if(myHelper.Error == true)
+ break;
+ }
+ Test.Eval(!myHelper.Error);
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 10;
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.EnterExitTest();
+ Gen<double>.EnterExitTest();
+ Gen<string>.EnterExitTest();
+ Gen<object>.EnterExitTest();
+ Gen<Guid>.EnterExitTest();
+
+ Gen<int[]>.EnterExitTest();
+ Gen<double[,]>.EnterExitTest();
+ Gen<string[][][]>.EnterExitTest();
+ Gen<object[,,,]>.EnterExitTest();
+ Gen<Guid[][,,,][]>.EnterExitTest();
+
+ Gen<RefX1<int>[]>.EnterExitTest();
+ Gen<RefX1<double>[,]>.EnterExitTest();
+ Gen<RefX1<string>[][][]>.EnterExitTest();
+ Gen<RefX1<object>[,,,]>.EnterExitTest();
+ Gen<RefX1<Guid>[][,,,][]>.EnterExitTest();
+
+ Gen<ValX1<int>[]>.EnterExitTest();
+ Gen<ValX1<double>[,]>.EnterExitTest();
+ Gen<ValX1<string>[][][]>.EnterExitTest();
+ Gen<ValX1<object>[,,,]>.EnterExitTest();
+ Gen<ValX1<Guid>[][,,,][]>.EnterExitTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit05.csproj b/tests/src/baseservices/threading/generics/Monitor/EnterExit05.csproj
new file mode 100644
index 0000000000..5d51e0dfef
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit05.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EnterExit05.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit06.cs b/tests/src/baseservices/threading/generics/Monitor/EnterExit06.cs
new file mode 100644
index 0000000000..53cda3220a
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit06.cs
@@ -0,0 +1,171 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+class Gen<T>
+{
+ public static void EnterExitTest<U>()
+ {
+ Type monitorT = typeof(Gen<T>).GetGenericTypeDefinition();
+ Type monitorU = typeof(Gen<U>).GetGenericTypeDefinition();
+
+ if(!monitorU.Equals(monitorT))
+ throw new Exception("Invalid use of test case, T must be equal to U - POSSIBLE TYPE SYSTEM BUG");
+
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ TestHelper myHelper2 = new TestHelper(Test.nThreads);
+ WaitHandle[] myWaiter = new WaitHandle[2];
+ myWaiter[0] = myHelper.m_Event;
+ myWaiter[1] = myHelper2.m_Event;
+
+ // for(int i=0;i<Test.nThreads;i++)
+ // {
+ // new MonitorDelegate(myHelper.Consumer).BeginInvoke(monitorT,null,null);
+ // new MonitorDelegate(myHelper2.Consumer).BeginInvoke(monitorU,null,null);
+ // }
+
+ for(int i=0;i<Test.nThreads;i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.Consumer(monitorT);
+ });
+
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper2.Consumer(monitorU);
+ });
+ }
+
+ for(int i=0;i<6;i++)
+ {
+ if(WaitHandle.WaitAll(myWaiter,10000))//,true))
+ break;
+ if(myHelper.Error == true || myHelper2.Error == true)
+ break;
+ }
+ Test.Eval(!(myHelper.Error && myHelper2.Error));
+ }
+
+}
+
+public class Test
+{
+ public static int nThreads = 10;
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<double>.EnterExitTest<int>();
+ Gen<string>.EnterExitTest<int>();
+ Gen<object>.EnterExitTest<int>();
+ Gen<Guid>.EnterExitTest<int>();
+ Gen<RefX1<int>>.EnterExitTest<int>();
+ Gen<RefX1<string>>.EnterExitTest<int>();
+ Gen<ValX1<int>>.EnterExitTest<int>();
+ Gen<ValX1<string>>.EnterExitTest<int>();
+
+ Gen<int>.EnterExitTest<double>();
+ Gen<string>.EnterExitTest<double>();
+ Gen<object>.EnterExitTest<double>();
+ Gen<Guid>.EnterExitTest<double>();
+ Gen<RefX1<int>>.EnterExitTest<double>();
+ Gen<RefX1<string>>.EnterExitTest<double>();
+ Gen<ValX1<int>>.EnterExitTest<double>();
+ Gen<ValX1<string>>.EnterExitTest<double>();
+
+ Gen<int>.EnterExitTest<string>();
+ Gen<double>.EnterExitTest<string>();
+ Gen<object>.EnterExitTest<string>();
+ Gen<Guid>.EnterExitTest<string>();
+ Gen<RefX1<int>>.EnterExitTest<string>();
+ Gen<RefX1<string>>.EnterExitTest<string>();
+ Gen<ValX1<int>>.EnterExitTest<string>();
+ Gen<ValX1<string>>.EnterExitTest<string>();
+
+ Gen<int>.EnterExitTest<object>();
+ Gen<double>.EnterExitTest<object>();
+ Gen<string>.EnterExitTest<object>();
+ Gen<Guid>.EnterExitTest<object>();
+ Gen<RefX1<int>>.EnterExitTest<object>();
+ Gen<RefX1<string>>.EnterExitTest<object>();
+ Gen<ValX1<int>>.EnterExitTest<object>();
+ Gen<ValX1<string>>.EnterExitTest<object>();
+
+ Gen<int>.EnterExitTest<Guid>();
+ Gen<double>.EnterExitTest<Guid>();
+ Gen<string>.EnterExitTest<Guid>();
+ Gen<object>.EnterExitTest<Guid>();
+ Gen<RefX1<int>>.EnterExitTest<Guid>();
+ Gen<RefX1<string>>.EnterExitTest<Guid>();
+ Gen<ValX1<int>>.EnterExitTest<Guid>();
+ Gen<ValX1<string>>.EnterExitTest<Guid>();
+
+ Gen<int>.EnterExitTest<RefX1<int>>();
+ Gen<double>.EnterExitTest<RefX1<int>>();
+ Gen<string>.EnterExitTest<RefX1<int>>();
+ Gen<object>.EnterExitTest<RefX1<int>>();
+ Gen<Guid>.EnterExitTest<RefX1<int>>();
+ Gen<RefX1<string>>.EnterExitTest<RefX1<int>>();
+ Gen<ValX1<int>>.EnterExitTest<RefX1<int>>();
+ Gen<ValX1<string>>.EnterExitTest<RefX1<int>>();
+
+ Gen<int>.EnterExitTest<RefX1<string>>();
+ Gen<double>.EnterExitTest<RefX1<string>>();
+ Gen<string>.EnterExitTest<RefX1<string>>();
+ Gen<object>.EnterExitTest<RefX1<string>>();
+ Gen<Guid>.EnterExitTest<RefX1<string>>();
+ Gen<RefX1<int>>.EnterExitTest<RefX1<string>>();
+ Gen<ValX1<int>>.EnterExitTest<RefX1<string>>();
+ Gen<ValX1<string>>.EnterExitTest<RefX1<string>>();
+
+ Gen<int>.EnterExitTest<ValX1<int>>();
+ Gen<double>.EnterExitTest<ValX1<int>>();
+ Gen<string>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<object>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<Guid>.EnterExitTest<ValX1<int>>();
+ Gen<RefX1<int>>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<RefX1<string>>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<ValX1<string>>.EnterExitTest<ValX1<int>>(); //offending line
+
+ Gen<int>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<double>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<string>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<object>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<Guid>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<RefX1<int>>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<RefX1<string>>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<ValX1<int>>.EnterExitTest<ValX1<string>>(); //offending line
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit06.csproj b/tests/src/baseservices/threading/generics/Monitor/EnterExit06.csproj
new file mode 100644
index 0000000000..a3cabe3af7
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit06.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EnterExit06.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit07.cs b/tests/src/baseservices/threading/generics/Monitor/EnterExit07.cs
new file mode 100644
index 0000000000..c36ef4b349
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit07.cs
@@ -0,0 +1,98 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+struct Gen<T>
+{
+ public static void EnterExitTest()
+ {
+ Type monitor = typeof(Gen<T>).GetGenericTypeDefinition();
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ // MonitorDelegate[] consumer = new MonitorDelegate[Test.nThreads];
+ // for(int i=0;i<Test.nThreads;i++)
+ // {
+ // consumer[i] = new MonitorDelegate(myHelper.Consumer);
+ // consumer[i].BeginInvoke(monitor,null,null);
+ // }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.Consumer(monitor);
+ });
+ }
+
+ for(int i=0;i<6;i++)
+ {
+ if(myHelper.m_Event.WaitOne(10000))//,true))
+ break;
+ if(myHelper.Error == true)
+ break;
+ }
+ Test.Eval(!myHelper.Error);
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 10;
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.EnterExitTest();
+ Gen<double>.EnterExitTest();
+ Gen<string>.EnterExitTest();
+ Gen<object>.EnterExitTest();
+ Gen<Guid>.EnterExitTest();
+
+ Gen<int[]>.EnterExitTest();
+ Gen<double[,]>.EnterExitTest();
+ Gen<string[][][]>.EnterExitTest();
+ Gen<object[,,,]>.EnterExitTest();
+ Gen<Guid[][,,,][]>.EnterExitTest();
+
+ Gen<RefX1<int>[]>.EnterExitTest();
+ Gen<RefX1<double>[,]>.EnterExitTest();
+ Gen<RefX1<string>[][][]>.EnterExitTest();
+ Gen<RefX1<object>[,,,]>.EnterExitTest();
+ Gen<RefX1<Guid>[][,,,][]>.EnterExitTest();
+
+ Gen<ValX1<int>[]>.EnterExitTest();
+ Gen<ValX1<double>[,]>.EnterExitTest();
+ Gen<ValX1<string>[][][]>.EnterExitTest();
+ Gen<ValX1<object>[,,,]>.EnterExitTest();
+ Gen<ValX1<Guid>[][,,,][]>.EnterExitTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit07.csproj b/tests/src/baseservices/threading/generics/Monitor/EnterExit07.csproj
new file mode 100644
index 0000000000..98d7775f94
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit07.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EnterExit07.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit08.cs b/tests/src/baseservices/threading/generics/Monitor/EnterExit08.cs
new file mode 100644
index 0000000000..747a86c420
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit08.cs
@@ -0,0 +1,171 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+
+struct Gen<T>
+{
+ public static void EnterExitTest<U>()
+ {
+ Type monitorT = typeof(Gen<T>).GetGenericTypeDefinition();
+ Type monitorU = typeof(Gen<U>).GetGenericTypeDefinition();
+
+ if(!monitorU.Equals(monitorT))
+ throw new Exception("Invalid use of test case, T must be equal to U - POSSIBLE TYPE SYSTEM BUG");
+
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ TestHelper myHelper2 = new TestHelper(Test.nThreads);
+ WaitHandle[] myWaiter = new WaitHandle[2];
+ myWaiter[0] = myHelper.m_Event;
+ myWaiter[1] = myHelper2.m_Event;
+ // for(int i=0;i<Test.nThreads;i++)
+ // {
+ // new MonitorDelegate(myHelper.Consumer).BeginInvoke(monitorT,null,null);
+ // new MonitorDelegate(myHelper2.Consumer).BeginInvoke(monitorU,null,null);
+ // }
+
+ for(int i=0;i<Test.nThreads;i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.Consumer(monitorT);
+ });
+
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper2.Consumer(monitorU);
+ });
+ }
+
+ for(int i=0;i<6;i++)
+ {
+ if(WaitHandle.WaitAll(myWaiter,10000))//,true))
+ break;
+ if(myHelper.Error == true || myHelper2.Error == true)
+ break;
+ }
+ Test.Eval(!(myHelper.Error && myHelper2.Error));
+ }
+
+}
+
+public class Test
+{
+ public static int nThreads = 10;
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<double>.EnterExitTest<int>();
+ Gen<string>.EnterExitTest<int>();
+ Gen<object>.EnterExitTest<int>();
+ Gen<Guid>.EnterExitTest<int>();
+ Gen<RefX1<int>>.EnterExitTest<int>();
+ Gen<RefX1<string>>.EnterExitTest<int>();
+ Gen<ValX1<int>>.EnterExitTest<int>();
+ Gen<ValX1<string>>.EnterExitTest<int>();
+
+ Gen<int>.EnterExitTest<double>();
+ Gen<string>.EnterExitTest<double>();
+ Gen<object>.EnterExitTest<double>();
+ Gen<Guid>.EnterExitTest<double>();
+ Gen<RefX1<int>>.EnterExitTest<double>();
+ Gen<RefX1<string>>.EnterExitTest<double>();
+ Gen<ValX1<int>>.EnterExitTest<double>();
+ Gen<ValX1<string>>.EnterExitTest<double>();
+
+ Gen<int>.EnterExitTest<string>();
+ Gen<double>.EnterExitTest<string>();
+ Gen<object>.EnterExitTest<string>();
+ Gen<Guid>.EnterExitTest<string>();
+ Gen<RefX1<int>>.EnterExitTest<string>();
+ Gen<RefX1<string>>.EnterExitTest<string>();
+ Gen<ValX1<int>>.EnterExitTest<string>();
+ Gen<ValX1<string>>.EnterExitTest<string>();
+
+ Gen<int>.EnterExitTest<object>();
+ Gen<double>.EnterExitTest<object>();
+ Gen<string>.EnterExitTest<object>();
+ Gen<Guid>.EnterExitTest<object>();
+ Gen<RefX1<int>>.EnterExitTest<object>();
+ Gen<RefX1<string>>.EnterExitTest<object>();
+ Gen<ValX1<int>>.EnterExitTest<object>();
+ Gen<ValX1<string>>.EnterExitTest<object>();
+
+ Gen<int>.EnterExitTest<Guid>();
+ Gen<double>.EnterExitTest<Guid>();
+ Gen<string>.EnterExitTest<Guid>();
+ Gen<object>.EnterExitTest<Guid>();
+ Gen<RefX1<int>>.EnterExitTest<Guid>();
+ Gen<RefX1<string>>.EnterExitTest<Guid>();
+ Gen<ValX1<int>>.EnterExitTest<Guid>();
+ Gen<ValX1<string>>.EnterExitTest<Guid>();
+
+ Gen<int>.EnterExitTest<RefX1<int>>();
+ Gen<double>.EnterExitTest<RefX1<int>>();
+ Gen<string>.EnterExitTest<RefX1<int>>();
+ Gen<object>.EnterExitTest<RefX1<int>>();
+ Gen<Guid>.EnterExitTest<RefX1<int>>();
+ Gen<RefX1<string>>.EnterExitTest<RefX1<int>>();
+ Gen<ValX1<int>>.EnterExitTest<RefX1<int>>();
+ Gen<ValX1<string>>.EnterExitTest<RefX1<int>>();
+
+ Gen<int>.EnterExitTest<RefX1<string>>();
+ Gen<double>.EnterExitTest<RefX1<string>>();
+ Gen<string>.EnterExitTest<RefX1<string>>();
+ Gen<object>.EnterExitTest<RefX1<string>>();
+ Gen<Guid>.EnterExitTest<RefX1<string>>();
+ Gen<RefX1<int>>.EnterExitTest<RefX1<string>>();
+ Gen<ValX1<int>>.EnterExitTest<RefX1<string>>();
+ Gen<ValX1<string>>.EnterExitTest<RefX1<string>>();
+
+ Gen<int>.EnterExitTest<ValX1<int>>();
+ Gen<double>.EnterExitTest<ValX1<int>>();
+ Gen<string>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<object>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<Guid>.EnterExitTest<ValX1<int>>();
+ Gen<RefX1<int>>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<RefX1<string>>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<ValX1<string>>.EnterExitTest<ValX1<int>>(); //offending line
+
+ Gen<int>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<double>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<string>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<object>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<Guid>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<RefX1<int>>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<RefX1<string>>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<ValX1<int>>.EnterExitTest<ValX1<string>>(); //offending line
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit08.csproj b/tests/src/baseservices/threading/generics/Monitor/EnterExit08.csproj
new file mode 100644
index 0000000000..8086661d8d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit08.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EnterExit08.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit09.cs b/tests/src/baseservices/threading/generics/Monitor/EnterExit09.cs
new file mode 100644
index 0000000000..3499e30183
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit09.cs
@@ -0,0 +1,97 @@
+// 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.Threading;
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+class Gen<T>
+{
+ public static void EnterExitTest()
+ {
+ Gen<T> monitor = new Gen<T>();
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ // MonitorDelegate[] consumer = new MonitorDelegate[Test.nThreads];
+ // for(int i=0;i<Test.nThreads;i++)
+ // {
+ // consumer[i] = new MonitorDelegate(myHelper.Consumer);
+ // consumer[i].BeginInvoke(monitor,null,null);
+ // }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.Consumer(monitor);
+ });
+ }
+
+ for(int i=0;i<6;i++)
+ {
+ if(myHelper.m_Event.WaitOne(10000))//,true))
+ break;
+ if(myHelper.Error == true)
+ break;
+ }
+ Test.Eval(!myHelper.Error);
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 10;
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.EnterExitTest();
+ Gen<double>.EnterExitTest();
+ Gen<string>.EnterExitTest();
+ Gen<object>.EnterExitTest();
+ Gen<Guid>.EnterExitTest();
+
+ Gen<int[]>.EnterExitTest();
+ Gen<double[,]>.EnterExitTest();
+ Gen<string[][][]>.EnterExitTest();
+ Gen<object[,,,]>.EnterExitTest();
+ Gen<Guid[][,,,][]>.EnterExitTest();
+
+ Gen<RefX1<int>[]>.EnterExitTest();
+ Gen<RefX1<double>[,]>.EnterExitTest();
+ Gen<RefX1<string>[][][]>.EnterExitTest();
+ Gen<RefX1<object>[,,,]>.EnterExitTest();
+ Gen<RefX1<Guid>[][,,,][]>.EnterExitTest();
+
+ Gen<ValX1<int>[]>.EnterExitTest();
+ Gen<ValX1<double>[,]>.EnterExitTest();
+ Gen<ValX1<string>[][][]>.EnterExitTest();
+ Gen<ValX1<object>[,,,]>.EnterExitTest();
+ Gen<ValX1<Guid>[][,,,][]>.EnterExitTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit09.csproj b/tests/src/baseservices/threading/generics/Monitor/EnterExit09.csproj
new file mode 100644
index 0000000000..51151b137e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit09.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EnterExit09.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit10.cs b/tests/src/baseservices/threading/generics/Monitor/EnterExit10.cs
new file mode 100644
index 0000000000..b55eaa1d45
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit10.cs
@@ -0,0 +1,113 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+
+class Gen<T>
+{
+ public static void EnterExitTest()
+ {
+ Gen<T> monitorT = new Gen<T>();
+ Gen<T> monitorU = new Gen<T>();
+
+ if(monitorU.Equals(monitorT))
+ throw new Exception("Invalid use of test case, T must not be equal to U - POSSIBLE TYPE SYSTEM BUG");
+
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ TestHelper myHelper2 = new TestHelper(Test.nThreads);
+ WaitHandle[] myWaiter = new WaitHandle[2];
+ myWaiter[0] = myHelper.m_Event;
+ myWaiter[1] = myHelper2.m_Event;
+ // for(int i=0;i<Test.nThreads;i++)
+ // {
+ // new MonitorDelegate(myHelper.Consumer).BeginInvoke(monitorT,null,null);
+ // new MonitorDelegate(myHelper2.Consumer).BeginInvoke(monitorU,null,null);
+ // }
+
+ for(int i=0;i<Test.nThreads;i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.Consumer(monitorT);
+ });
+
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper2.Consumer(monitorU);
+ });
+ }
+
+ for(int i=0;i<6;i++)
+ {
+ if(WaitHandle.WaitAll(myWaiter,10000))//,true))
+ break;
+ if(myHelper.Error == true || myHelper2.Error == true)
+ break;
+ }
+ Test.Eval(!(myHelper.Error && myHelper2.Error));
+ }
+
+}
+
+public class Test
+{
+ public static int nThreads = 10;
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.EnterExitTest();
+ Gen<double>.EnterExitTest();
+ Gen<string>.EnterExitTest();
+ Gen<object>.EnterExitTest();
+ Gen<Guid>.EnterExitTest();
+
+ Gen<int[]>.EnterExitTest();
+ Gen<double[,]>.EnterExitTest();
+ Gen<string[][][]>.EnterExitTest();
+ Gen<object[,,,]>.EnterExitTest();
+ Gen<Guid[][,,,][]>.EnterExitTest();
+
+ Gen<RefX1<int>[]>.EnterExitTest();
+ Gen<RefX1<double>[,]>.EnterExitTest();
+ Gen<RefX1<string>[][][]>.EnterExitTest();
+ Gen<RefX1<object>[,,,]>.EnterExitTest();
+ Gen<RefX1<Guid>[][,,,][]>.EnterExitTest();
+
+ Gen<ValX1<int>[]>.EnterExitTest();
+ Gen<ValX1<double>[,]>.EnterExitTest();
+ Gen<ValX1<string>[][][]>.EnterExitTest();
+ Gen<ValX1<object>[,,,]>.EnterExitTest();
+ Gen<ValX1<Guid>[][,,,][]>.EnterExitTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit10.csproj b/tests/src/baseservices/threading/generics/Monitor/EnterExit10.csproj
new file mode 100644
index 0000000000..6ae9143e7b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit10.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EnterExit10.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit11.cs b/tests/src/baseservices/threading/generics/Monitor/EnterExit11.cs
new file mode 100644
index 0000000000..e01b74c413
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit11.cs
@@ -0,0 +1,102 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+
+class Gen<T>
+{
+ public static object staticLock;
+
+ public static void EnterExitTest()
+ {
+
+ Gen<T>.staticLock = new object();
+
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ // MonitorDelegate[] consumer = new MonitorDelegate[Test.nThreads];
+ // for(int i=0;i<consumer.Length;i++){
+ // consumer[i] = new MonitorDelegate(myHelper.Consumer);
+ // consumer[i].BeginInvoke(staticLock,null,null);
+ // }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.Consumer(staticLock);
+ });
+ }
+
+ for(int i=0;i<6;i++){
+ if(myHelper.m_Event.WaitOne(10000))//,true))
+ break;
+ if(myHelper.Error == true)
+ break;
+ }
+ Test.Eval(!myHelper.Error);
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.EnterExitTest();
+ Gen<double>.EnterExitTest();
+ Gen<string>.EnterExitTest();
+ Gen<object>.EnterExitTest();
+ Gen<Guid>.EnterExitTest();
+
+ Gen<int[]>.EnterExitTest();
+ Gen<double[,]>.EnterExitTest();
+ Gen<string[][][]>.EnterExitTest();
+ Gen<object[,,,]>.EnterExitTest();
+ Gen<Guid[][,,,][]>.EnterExitTest();
+
+ Gen<RefX1<int>[]>.EnterExitTest();
+ Gen<RefX1<double>[,]>.EnterExitTest();
+ Gen<RefX1<string>[][][]>.EnterExitTest();
+ Gen<RefX1<object>[,,,]>.EnterExitTest();
+ Gen<RefX1<Guid>[][,,,][]>.EnterExitTest();
+
+ Gen<ValX1<int>[]>.EnterExitTest();
+ Gen<ValX1<double>[,]>.EnterExitTest();
+ Gen<ValX1<string>[][][]>.EnterExitTest();
+ Gen<ValX1<object>[,,,]>.EnterExitTest();
+ Gen<ValX1<Guid>[][,,,][]>.EnterExitTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit11.csproj b/tests/src/baseservices/threading/generics/Monitor/EnterExit11.csproj
new file mode 100644
index 0000000000..da1cd6cfc5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit11.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EnterExit11.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit12.cs b/tests/src/baseservices/threading/generics/Monitor/EnterExit12.cs
new file mode 100644
index 0000000000..b868cd4429
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit12.cs
@@ -0,0 +1,179 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+class Gen<T>
+{
+ public static object staticLock;
+
+ public static void EnterExitTest<U>()
+ {
+
+ Gen<T>.staticLock = new object();
+ Gen<U>.staticLock = new object();
+
+ object monitorT = Gen<T>.staticLock;
+ object monitorU = Gen<U>.staticLock;
+
+ if(monitorU.Equals(monitorT))
+ throw new Exception("Invalid use of test case, T must not be equal to U - POSSIBLE TYPE SYSTEM BUG");
+
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ TestHelper myHelper2 = new TestHelper(Test.nThreads);
+ WaitHandle[] myWaiter = new WaitHandle[2];
+ myWaiter[0] = myHelper.m_Event;
+ myWaiter[1] = myHelper2.m_Event;
+ // for(int i=0;i<Test.nThreads;i++)
+ // {
+ // new MonitorDelegate(myHelper.Consumer).BeginInvoke(monitorT,null,null);
+ // new MonitorDelegate(myHelper2.Consumer).BeginInvoke(monitorU,null,null);
+ // }
+
+ for(int i=0; i<Test.nThreads; i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.Consumer(monitorT);
+ });
+
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper2.Consumer(monitorU);
+ });
+ }
+
+ for(int i=0;i<6;i++)
+ {
+ if(WaitHandle.WaitAll(myWaiter,10000))//,true))
+ break;
+ if(myHelper.Error == true || myHelper2.Error == true)
+ break;
+ }
+ Test.Eval(!(myHelper.Error && myHelper2.Error));
+ }
+
+
+
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<double>.EnterExitTest<int>();
+ Gen<string>.EnterExitTest<int>();
+ Gen<object>.EnterExitTest<int>();
+ Gen<Guid>.EnterExitTest<int>();
+ Gen<RefX1<int>>.EnterExitTest<int>();
+ Gen<RefX1<string>>.EnterExitTest<int>();
+ Gen<ValX1<int>>.EnterExitTest<int>();
+ Gen<ValX1<string>>.EnterExitTest<int>();
+
+ Gen<int>.EnterExitTest<double>();
+ Gen<string>.EnterExitTest<double>();
+ Gen<object>.EnterExitTest<double>();
+ Gen<Guid>.EnterExitTest<double>();
+ Gen<RefX1<int>>.EnterExitTest<double>();
+ Gen<RefX1<string>>.EnterExitTest<double>();
+ Gen<ValX1<int>>.EnterExitTest<double>();
+ Gen<ValX1<string>>.EnterExitTest<double>();
+
+ Gen<int>.EnterExitTest<string>();
+ Gen<double>.EnterExitTest<string>();
+ Gen<object>.EnterExitTest<string>();
+ Gen<Guid>.EnterExitTest<string>();
+ Gen<RefX1<int>>.EnterExitTest<string>();
+ Gen<RefX1<string>>.EnterExitTest<string>();
+ Gen<ValX1<int>>.EnterExitTest<string>();
+ Gen<ValX1<string>>.EnterExitTest<string>();
+
+ Gen<int>.EnterExitTest<object>();
+ Gen<double>.EnterExitTest<object>();
+ Gen<string>.EnterExitTest<object>();
+ Gen<Guid>.EnterExitTest<object>();
+ Gen<RefX1<int>>.EnterExitTest<object>();
+ Gen<RefX1<string>>.EnterExitTest<object>();
+ Gen<ValX1<int>>.EnterExitTest<object>();
+ Gen<ValX1<string>>.EnterExitTest<object>();
+
+ Gen<int>.EnterExitTest<Guid>();
+ Gen<double>.EnterExitTest<Guid>();
+ Gen<string>.EnterExitTest<Guid>();
+ Gen<object>.EnterExitTest<Guid>();
+ Gen<RefX1<int>>.EnterExitTest<Guid>();
+ Gen<RefX1<string>>.EnterExitTest<Guid>();
+ Gen<ValX1<int>>.EnterExitTest<Guid>();
+ Gen<ValX1<string>>.EnterExitTest<Guid>();
+
+ Gen<int>.EnterExitTest<RefX1<int>>();
+ Gen<double>.EnterExitTest<RefX1<int>>();
+ Gen<string>.EnterExitTest<RefX1<int>>();
+ Gen<object>.EnterExitTest<RefX1<int>>();
+ Gen<Guid>.EnterExitTest<RefX1<int>>();
+ Gen<RefX1<string>>.EnterExitTest<RefX1<int>>();
+ Gen<ValX1<int>>.EnterExitTest<RefX1<int>>();
+ Gen<ValX1<string>>.EnterExitTest<RefX1<int>>();
+
+ Gen<int>.EnterExitTest<RefX1<string>>();
+ Gen<double>.EnterExitTest<RefX1<string>>();
+ Gen<string>.EnterExitTest<RefX1<string>>();
+ Gen<object>.EnterExitTest<RefX1<string>>();
+ Gen<Guid>.EnterExitTest<RefX1<string>>();
+ Gen<RefX1<int>>.EnterExitTest<RefX1<string>>();
+ Gen<ValX1<int>>.EnterExitTest<RefX1<string>>();
+ Gen<ValX1<string>>.EnterExitTest<RefX1<string>>();
+
+ Gen<int>.EnterExitTest<ValX1<int>>();
+ Gen<double>.EnterExitTest<ValX1<int>>();
+ Gen<string>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<object>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<Guid>.EnterExitTest<ValX1<int>>();
+ Gen<RefX1<int>>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<RefX1<string>>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<ValX1<string>>.EnterExitTest<ValX1<int>>(); //offending line
+
+ Gen<int>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<double>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<string>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<object>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<Guid>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<RefX1<int>>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<RefX1<string>>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<ValX1<int>>.EnterExitTest<ValX1<string>>(); //offending line
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit12.csproj b/tests/src/baseservices/threading/generics/Monitor/EnterExit12.csproj
new file mode 100644
index 0000000000..f2e56091b4
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit12.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EnterExit12.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit13.cs b/tests/src/baseservices/threading/generics/Monitor/EnterExit13.cs
new file mode 100644
index 0000000000..ffe7bd2f64
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit13.cs
@@ -0,0 +1,101 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+struct Gen<T>
+{
+ public static object staticLock;
+
+ public static void EnterExitTest()
+ {
+ staticLock = new object();
+ object monitor = staticLock;
+
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ // MonitorDelegate[] consumer = new MonitorDelegate[Test.nThreads];
+ // for(int i=0;i<consumer.Length;i++){
+ // consumer[i] = new MonitorDelegate(myHelper.Consumer);
+ // consumer[i].BeginInvoke(staticLock,null,null);
+ // }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.Consumer(staticLock);
+ });
+ }
+
+ for(int i=0;i<6;i++){
+ if(myHelper.m_Event.WaitOne(10000))//,true))
+ break;
+ if(myHelper.Error == true)
+ break;
+ }
+ Test.Eval(!myHelper.Error);
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.EnterExitTest();
+ Gen<double>.EnterExitTest();
+ Gen<string>.EnterExitTest();
+ Gen<object>.EnterExitTest();
+ Gen<Guid>.EnterExitTest();
+
+ Gen<int[]>.EnterExitTest();
+ Gen<double[,]>.EnterExitTest();
+ Gen<string[][][]>.EnterExitTest();
+ Gen<object[,,,]>.EnterExitTest();
+ Gen<Guid[][,,,][]>.EnterExitTest();
+
+ Gen<RefX1<int>[]>.EnterExitTest();
+ Gen<RefX1<double>[,]>.EnterExitTest();
+ Gen<RefX1<string>[][][]>.EnterExitTest();
+ Gen<RefX1<object>[,,,]>.EnterExitTest();
+ Gen<RefX1<Guid>[][,,,][]>.EnterExitTest();
+
+ Gen<ValX1<int>[]>.EnterExitTest();
+ Gen<ValX1<double>[,]>.EnterExitTest();
+ Gen<ValX1<string>[][][]>.EnterExitTest();
+ Gen<ValX1<object>[,,,]>.EnterExitTest();
+ Gen<ValX1<Guid>[][,,,][]>.EnterExitTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit13.csproj b/tests/src/baseservices/threading/generics/Monitor/EnterExit13.csproj
new file mode 100644
index 0000000000..cd6256f934
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit13.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EnterExit13.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit14.cs b/tests/src/baseservices/threading/generics/Monitor/EnterExit14.cs
new file mode 100644
index 0000000000..f5c3ba3d69
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit14.cs
@@ -0,0 +1,178 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+struct Gen<T>
+{
+ public static object staticLock;
+ public static void EnterExitTest<U>()
+ {
+
+ Gen<T>.staticLock = new object();
+ Gen<U>.staticLock = new object();
+
+ object monitorT = Gen<T>.staticLock;
+ object monitorU = Gen<U>.staticLock;
+
+ if(monitorU.Equals(monitorT))
+ throw new Exception("Invalid use of test case, T must not be equal to U - POSSIBLE TYPE SYSTEM BUG");
+
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ TestHelper myHelper2 = new TestHelper(Test.nThreads);
+ WaitHandle[] myWaiter = new WaitHandle[2];
+ myWaiter[0] = myHelper.m_Event;
+ myWaiter[1] = myHelper2.m_Event;
+ // for(int i=0;i<Test.nThreads;i++)
+ // {
+ // new MonitorDelegate(myHelper.Consumer).BeginInvoke(monitorT,null,null);
+ // new MonitorDelegate(myHelper2.Consumer).BeginInvoke(monitorU,null,null);
+ // }
+
+ for(int i=0; i<Test.nThreads; i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.Consumer(monitorT);
+ });
+
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper2.Consumer(monitorU);
+ });
+ }
+
+ for(int i=0;i<6;i++)
+ {
+ if(WaitHandle.WaitAll(myWaiter,10000))//,true))
+ break;
+ if(myHelper.Error == true || myHelper2.Error == true)
+ break;
+ }
+ Test.Eval(!(myHelper.Error && myHelper2.Error));
+ }
+
+
+
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<double>.EnterExitTest<int>();
+ Gen<string>.EnterExitTest<int>();
+ Gen<object>.EnterExitTest<int>();
+ Gen<Guid>.EnterExitTest<int>();
+ Gen<RefX1<int>>.EnterExitTest<int>();
+ Gen<RefX1<string>>.EnterExitTest<int>();
+ Gen<ValX1<int>>.EnterExitTest<int>();
+ Gen<ValX1<string>>.EnterExitTest<int>();
+
+ Gen<int>.EnterExitTest<double>();
+ Gen<string>.EnterExitTest<double>();
+ Gen<object>.EnterExitTest<double>();
+ Gen<Guid>.EnterExitTest<double>();
+ Gen<RefX1<int>>.EnterExitTest<double>();
+ Gen<RefX1<string>>.EnterExitTest<double>();
+ Gen<ValX1<int>>.EnterExitTest<double>();
+ Gen<ValX1<string>>.EnterExitTest<double>();
+
+ Gen<int>.EnterExitTest<string>();
+ Gen<double>.EnterExitTest<string>();
+ Gen<object>.EnterExitTest<string>();
+ Gen<Guid>.EnterExitTest<string>();
+ Gen<RefX1<int>>.EnterExitTest<string>();
+ Gen<RefX1<string>>.EnterExitTest<string>();
+ Gen<ValX1<int>>.EnterExitTest<string>();
+ Gen<ValX1<string>>.EnterExitTest<string>();
+
+ Gen<int>.EnterExitTest<object>();
+ Gen<double>.EnterExitTest<object>();
+ Gen<string>.EnterExitTest<object>();
+ Gen<Guid>.EnterExitTest<object>();
+ Gen<RefX1<int>>.EnterExitTest<object>();
+ Gen<RefX1<string>>.EnterExitTest<object>();
+ Gen<ValX1<int>>.EnterExitTest<object>();
+ Gen<ValX1<string>>.EnterExitTest<object>();
+
+ Gen<int>.EnterExitTest<Guid>();
+ Gen<double>.EnterExitTest<Guid>();
+ Gen<string>.EnterExitTest<Guid>();
+ Gen<object>.EnterExitTest<Guid>();
+ Gen<RefX1<int>>.EnterExitTest<Guid>();
+ Gen<RefX1<string>>.EnterExitTest<Guid>();
+ Gen<ValX1<int>>.EnterExitTest<Guid>();
+ Gen<ValX1<string>>.EnterExitTest<Guid>();
+
+ Gen<int>.EnterExitTest<RefX1<int>>();
+ Gen<double>.EnterExitTest<RefX1<int>>();
+ Gen<string>.EnterExitTest<RefX1<int>>();
+ Gen<object>.EnterExitTest<RefX1<int>>();
+ Gen<Guid>.EnterExitTest<RefX1<int>>();
+ Gen<RefX1<string>>.EnterExitTest<RefX1<int>>();
+ Gen<ValX1<int>>.EnterExitTest<RefX1<int>>();
+ Gen<ValX1<string>>.EnterExitTest<RefX1<int>>();
+
+ Gen<int>.EnterExitTest<RefX1<string>>();
+ Gen<double>.EnterExitTest<RefX1<string>>();
+ Gen<string>.EnterExitTest<RefX1<string>>();
+ Gen<object>.EnterExitTest<RefX1<string>>();
+ Gen<Guid>.EnterExitTest<RefX1<string>>();
+ Gen<RefX1<int>>.EnterExitTest<RefX1<string>>();
+ Gen<ValX1<int>>.EnterExitTest<RefX1<string>>();
+ Gen<ValX1<string>>.EnterExitTest<RefX1<string>>();
+
+ Gen<int>.EnterExitTest<ValX1<int>>();
+ Gen<double>.EnterExitTest<ValX1<int>>();
+ Gen<string>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<object>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<Guid>.EnterExitTest<ValX1<int>>();
+ Gen<RefX1<int>>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<RefX1<string>>.EnterExitTest<ValX1<int>>(); //offending line
+ Gen<ValX1<string>>.EnterExitTest<ValX1<int>>(); //offending line
+
+ Gen<int>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<double>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<string>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<object>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<Guid>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<RefX1<int>>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<RefX1<string>>.EnterExitTest<ValX1<string>>(); //offending line
+ Gen<ValX1<int>>.EnterExitTest<ValX1<string>>(); //offending line
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/EnterExit14.csproj b/tests/src/baseservices/threading/generics/Monitor/EnterExit14.csproj
new file mode 100644
index 0000000000..3988883d0f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit14.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EnterExit14.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/MonitorHelper.cs b/tests/src/baseservices/threading/generics/Monitor/MonitorHelper.cs
new file mode 100644
index 0000000000..716fbbc354
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/MonitorHelper.cs
@@ -0,0 +1,89 @@
+// 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.Threading;
+delegate void MonitorDelegate(object monitor);
+delegate void MonitorDelegateTS(object monitor,int timeout);
+
+class TestHelper
+{
+ private int m_iSharedData;
+ private int m_iRequestedEntries;
+ public ManualResetEvent m_Event;
+ public bool m_bError;
+
+ public bool Error
+ {
+ set
+ {
+ lock(typeof(TestHelper))
+ {
+ m_bError = value;
+ }
+ }
+ get
+ {
+ lock(typeof(TestHelper))
+ {
+ return m_bError;
+ }
+ }
+ }
+
+ public TestHelper(int num)
+ {
+ m_Event = new ManualResetEvent(false);
+ m_iSharedData = 0;
+ m_iRequestedEntries = num;
+ m_bError = false;
+ }
+
+ public void DoWork()
+ {
+ int snapshot = m_iSharedData;
+ Thread.Sleep(5);
+#if (DEBUG)
+ Console.WriteLine("Entering Monitor: " + m_iSharedData);
+#endif
+ m_iSharedData++;
+ Thread.Sleep(1);
+ if(m_iSharedData != snapshot + 1)
+ {
+ Error = true;
+ Console.WriteLine("Failure!!!");
+ }
+#if (DEBUG)
+ Console.WriteLine("Leaving Monitor: " + m_iSharedData);
+#endif
+ if(m_iSharedData == m_iRequestedEntries)
+ m_Event.Set();
+ }
+ public void Consumer(object monitor)
+ {
+ lock(monitor)
+ {
+ DoWork();
+ }
+ }
+ public void ConsumerTryEnter(object monitor,int timeout)
+ {
+ try
+ {
+ bool tookLock = false;
+
+ Monitor.TryEnter(monitor,timeout, ref tookLock);
+
+ while(!tookLock) {
+ Thread.Sleep(0);
+ Monitor.TryEnter(monitor,timeout, ref tookLock);
+ }
+
+ DoWork();
+ }
+ finally
+ {
+ Monitor.Exit(monitor);
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/TryEnter01.cs b/tests/src/baseservices/threading/generics/Monitor/TryEnter01.cs
new file mode 100644
index 0000000000..ebb8ed0e6e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter01.cs
@@ -0,0 +1,98 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+class Gen<T>
+{
+ public static void TryEnterTest()
+ {
+ // Gen<T> inst = new Gen<T>();
+ Type monitor = typeof(Gen<T>);
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ // MonitorDelegateTS[] consumer = new MonitorDelegateTS[Test.nThreads];
+ // for(int i=0;i<consumer.Length;i++){
+ // consumer[i] = new MonitorDelegateTS(myHelper.ConsumerTryEnter);
+ // consumer[i].BeginInvoke(monitor,100,null,null);
+ // }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.ConsumerTryEnter(monitor, 100);
+ });
+ }
+
+ for(int i=0;i<6;i++){
+ if(myHelper.m_Event.WaitOne(10000))//,true))
+ break;
+ if(myHelper.Error == true)
+ break;
+ }
+ Test.Eval(!myHelper.Error);
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 25;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.TryEnterTest();
+ Gen<double>.TryEnterTest();
+ Gen<string>.TryEnterTest();
+ Gen<object>.TryEnterTest();
+ Gen<Guid>.TryEnterTest();
+
+ Gen<int[]>.TryEnterTest();
+ Gen<double[,]>.TryEnterTest();
+ Gen<string[][][]>.TryEnterTest();
+ Gen<object[,,,]>.TryEnterTest();
+ Gen<Guid[][,,,][]>.TryEnterTest();
+
+ Gen<RefX1<int>[]>.TryEnterTest();
+ Gen<RefX1<double>[,]>.TryEnterTest();
+ Gen<RefX1<string>[][][]>.TryEnterTest();
+ Gen<RefX1<object>[,,,]>.TryEnterTest();
+ Gen<RefX1<Guid>[][,,,][]>.TryEnterTest();
+
+ Gen<ValX1<int>[]>.TryEnterTest();
+ Gen<ValX1<double>[,]>.TryEnterTest();
+ Gen<ValX1<string>[][][]>.TryEnterTest();
+ Gen<ValX1<object>[,,,]>.TryEnterTest();
+ Gen<ValX1<Guid>[][,,,][]>.TryEnterTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/TryEnter01.csproj b/tests/src/baseservices/threading/generics/Monitor/TryEnter01.csproj
new file mode 100644
index 0000000000..1afdd54db1
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter01.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="TryEnter01.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/TryEnter03.cs b/tests/src/baseservices/threading/generics/Monitor/TryEnter03.cs
new file mode 100644
index 0000000000..048ebbd99c
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter03.cs
@@ -0,0 +1,177 @@
+// 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.Threading;
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+class Gen<T>
+{
+
+ public static void TryEnterTest<U>(bool TisU)
+ {
+ Type monitorT = typeof(Gen<T>);
+ Type monitorU = typeof(Gen<U>);
+
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ TestHelper myHelper2 = new TestHelper(Test.nThreads);
+
+ WaitHandle[] myWaiter = new WaitHandle[2];
+ myWaiter[0] = myHelper.m_Event;
+ myWaiter[1] = myHelper2.m_Event;
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ // new MonitorDelegateTS(myHelper.ConsumerTryEnter).BeginInvoke(monitorT,100,null,null);
+ // new MonitorDelegateTS(myHelper2.ConsumerTryEnter).BeginInvoke(monitorU,100,null,null);
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.ConsumerTryEnter(monitorT, 100);
+ });
+
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper2.ConsumerTryEnter(monitorU, 100);
+ });
+ }
+
+ for(int i=0;i<6;i++)
+ {
+ if(WaitHandle.WaitAll(myWaiter,10000))//,true))
+ break;
+ if(myHelper.Error == true || myHelper2.Error == true)
+ break;
+ }
+ Test.Eval(!(myHelper.Error && myHelper2.Error));
+
+ }
+
+
+
+}
+
+public class Test
+{
+ public static int nThreads = 25;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.TryEnterTest<int>(true);
+ Gen<double>.TryEnterTest<int>(false);
+ Gen<string>.TryEnterTest<int>(false);
+ Gen<object>.TryEnterTest<int>(false);
+ Gen<Guid>.TryEnterTest<int>(false);
+ Gen<RefX1<int>>.TryEnterTest<int>(false);
+ Gen<RefX1<string>>.TryEnterTest<int>(false);
+ Gen<ValX1<int>>.TryEnterTest<int>(false);
+ Gen<ValX1<string>>.TryEnterTest<int>(false);
+
+ Gen<int>.TryEnterTest<double>(false);
+ Gen<double>.TryEnterTest<double>(true);
+ Gen<string>.TryEnterTest<double>(false);
+ Gen<object>.TryEnterTest<double>(false);
+ Gen<Guid>.TryEnterTest<double>(false);
+ Gen<RefX1<int>>.TryEnterTest<double>(false);
+ Gen<RefX1<string>>.TryEnterTest<double>(false);
+ Gen<ValX1<int>>.TryEnterTest<double>(false);
+ Gen<ValX1<string>>.TryEnterTest<double>(false);
+
+ Gen<int>.TryEnterTest<string>(false);
+ Gen<double>.TryEnterTest<string>(false);
+ Gen<string>.TryEnterTest<string>(true);
+ Gen<object>.TryEnterTest<string>(false);
+ Gen<Guid>.TryEnterTest<string>(false);
+ Gen<RefX1<int>>.TryEnterTest<string>(false);
+ Gen<RefX1<string>>.TryEnterTest<string>(false);
+ Gen<ValX1<int>>.TryEnterTest<string>(false);
+ Gen<ValX1<string>>.TryEnterTest<string>(false);
+
+ Gen<int>.TryEnterTest<object>(false);
+ Gen<double>.TryEnterTest<object>(false);
+ Gen<string>.TryEnterTest<object>(false);
+ Gen<object>.TryEnterTest<object>(true);
+ Gen<Guid>.TryEnterTest<object>(false);
+ Gen<RefX1<int>>.TryEnterTest<object>(false);
+ Gen<RefX1<string>>.TryEnterTest<object>(false);
+ Gen<ValX1<int>>.TryEnterTest<object>(false);
+ Gen<ValX1<string>>.TryEnterTest<object>(false);
+
+ Gen<int>.TryEnterTest<Guid>(false);
+ Gen<double>.TryEnterTest<Guid>(false);
+ Gen<string>.TryEnterTest<Guid>(false);
+ Gen<object>.TryEnterTest<Guid>(false);
+ Gen<Guid>.TryEnterTest<Guid>(true);
+ Gen<RefX1<int>>.TryEnterTest<Guid>(false);
+ Gen<RefX1<string>>.TryEnterTest<Guid>(false);
+ Gen<ValX1<int>>.TryEnterTest<Guid>(false);
+ Gen<ValX1<string>>.TryEnterTest<Guid>(false);
+
+ Gen<int>.TryEnterTest<RefX1<int>>(false);
+ Gen<double>.TryEnterTest<RefX1<int>>(false);
+ Gen<string>.TryEnterTest<RefX1<int>>(false);
+ Gen<object>.TryEnterTest<RefX1<int>>(false);
+ Gen<Guid>.TryEnterTest<RefX1<int>>(false);
+ Gen<RefX1<int>>.TryEnterTest<RefX1<int>>(true);
+ Gen<RefX1<string>>.TryEnterTest<RefX1<int>>(false);
+ Gen<ValX1<int>>.TryEnterTest<RefX1<int>>(false);
+ Gen<ValX1<string>>.TryEnterTest<RefX1<int>>(false);
+
+ Gen<int>.TryEnterTest<RefX1<string>>(false);
+ Gen<double>.TryEnterTest<RefX1<string>>(false);
+ Gen<string>.TryEnterTest<RefX1<string>>(false);
+ Gen<object>.TryEnterTest<RefX1<string>>(false);
+ Gen<Guid>.TryEnterTest<RefX1<string>>(false);
+ Gen<RefX1<int>>.TryEnterTest<RefX1<string>>(false);
+ Gen<RefX1<string>>.TryEnterTest<RefX1<string>>(true);
+ Gen<ValX1<int>>.TryEnterTest<RefX1<string>>(false);
+ Gen<ValX1<string>>.TryEnterTest<RefX1<string>>(false);
+
+ Gen<int>.TryEnterTest<ValX1<int>>(false);
+ Gen<double>.TryEnterTest<ValX1<int>>(false);
+ Gen<string>.TryEnterTest<ValX1<int>>(false); //offending line
+ Gen<object>.TryEnterTest<ValX1<int>>(false); //offending line
+ Gen<Guid>.TryEnterTest<ValX1<int>>(false);
+ Gen<RefX1<int>>.TryEnterTest<ValX1<int>>(false); //offending line
+ Gen<RefX1<string>>.TryEnterTest<ValX1<int>>(false); //offending line
+ Gen<ValX1<int>>.TryEnterTest<ValX1<int>>(true);
+ Gen<ValX1<string>>.TryEnterTest<ValX1<int>>(false); //offending line
+
+ Gen<int>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<double>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<string>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<object>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<Guid>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<RefX1<int>>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<RefX1<string>>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<ValX1<int>>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<ValX1<string>>.TryEnterTest<ValX1<string>>(true); //offending line
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/TryEnter03.csproj b/tests/src/baseservices/threading/generics/Monitor/TryEnter03.csproj
new file mode 100644
index 0000000000..305c707755
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter03.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="TryEnter03.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/TryEnter04.cs b/tests/src/baseservices/threading/generics/Monitor/TryEnter04.cs
new file mode 100644
index 0000000000..cff327921b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter04.cs
@@ -0,0 +1,99 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+struct Gen<T>
+{
+ public static void TryEnterTest()
+ {
+// #pragma warning disable 219
+// Gen<T> inst = new Gen<T>();
+// #pragma warning restore
+ Type monitor = typeof(Gen<T>);
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ // MonitorDelegateTS[] consumer = new MonitorDelegateTS[Test.nThreads];
+ // for(int i=0;i<consumer.Length;i++){
+ // consumer[i] = new MonitorDelegateTS(myHelper.ConsumerTryEnter);
+ // consumer[i].BeginInvoke(monitor,100,null,null);
+ // }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.ConsumerTryEnter(monitor, 100);
+ });
+ }
+
+ for(int i=0;i<6;i++){
+ if(myHelper.m_Event.WaitOne(10000))//,true))
+ break;
+ if(myHelper.Error == true)
+ break;
+ }
+ Test.Eval(!myHelper.Error);
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 25;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.TryEnterTest();
+ /*Gen<double>.TryEnterTest();
+ Gen<string>.TryEnterTest();
+ Gen<object>.TryEnterTest();
+ Gen<Guid>.TryEnterTest();
+
+ Gen<int[]>.TryEnterTest();
+ Gen<double[,]>.TryEnterTest();
+ Gen<string[][][]>.TryEnterTest();
+ Gen<object[,,,]>.TryEnterTest();
+ Gen<Guid[][,,,][]>.TryEnterTest();
+
+ Gen<RefX1<int>[]>.TryEnterTest();
+ Gen<RefX1<double>[,]>.TryEnterTest();
+ Gen<RefX1<string>[][][]>.TryEnterTest();
+ Gen<RefX1<object>[,,,]>.TryEnterTest();
+ Gen<RefX1<Guid>[][,,,][]>.TryEnterTest();
+
+ Gen<ValX1<int>[]>.TryEnterTest();
+ Gen<ValX1<double>[,]>.TryEnterTest();
+ Gen<ValX1<string>[][][]>.TryEnterTest();
+ Gen<ValX1<object>[,,,]>.TryEnterTest();
+ Gen<ValX1<Guid>[][,,,][]>.TryEnterTest();*/
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/TryEnter04.csproj b/tests/src/baseservices/threading/generics/Monitor/TryEnter04.csproj
new file mode 100644
index 0000000000..ad2588bb58
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter04.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="TryEnter04.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/TryEnter05.cs b/tests/src/baseservices/threading/generics/Monitor/TryEnter05.cs
new file mode 100644
index 0000000000..314b211364
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter05.cs
@@ -0,0 +1,99 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+struct Gen<T>
+{
+ delegate void StructDelegateTS(object monitor,int timeout);
+
+ public static void TryEnterTest()
+ {
+ Type monitor = typeof(Gen<T>);
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ // StructDelegateTS[] consumer = new StructDelegateTS[Test.nThreads];
+ // for(int i=0;i<consumer.Length;i++){
+ // consumer[i] = new StructDelegateTS(myHelper.ConsumerTryEnter);
+ // consumer[i].BeginInvoke(monitor,100,null,null);
+ // }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.ConsumerTryEnter(monitor, 100);
+ });
+ }
+
+ for(int i=0;i<6;i++){
+ if(myHelper.m_Event.WaitOne(10000))//,true))
+ break;
+ if(myHelper.Error == true)
+ break;
+ }
+ Test.Eval(!myHelper.Error);
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 25;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.TryEnterTest();
+ Gen<double>.TryEnterTest();
+ Gen<string>.TryEnterTest();
+ Gen<object>.TryEnterTest();
+ Gen<Guid>.TryEnterTest();
+
+ Gen<int[]>.TryEnterTest();
+ Gen<double[,]>.TryEnterTest();
+ Gen<string[][][]>.TryEnterTest();
+ Gen<object[,,,]>.TryEnterTest();
+ Gen<Guid[][,,,][]>.TryEnterTest();
+
+ Gen<RefX1<int>[]>.TryEnterTest();
+ Gen<RefX1<double>[,]>.TryEnterTest();
+ Gen<RefX1<string>[][][]>.TryEnterTest();
+ Gen<RefX1<object>[,,,]>.TryEnterTest();
+ Gen<RefX1<Guid>[][,,,][]>.TryEnterTest();
+
+ Gen<ValX1<int>[]>.TryEnterTest();
+ Gen<ValX1<double>[,]>.TryEnterTest();
+ Gen<ValX1<string>[][][]>.TryEnterTest();
+ Gen<ValX1<object>[,,,]>.TryEnterTest();
+ Gen<ValX1<Guid>[][,,,][]>.TryEnterTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/TryEnter05.csproj b/tests/src/baseservices/threading/generics/Monitor/TryEnter05.csproj
new file mode 100644
index 0000000000..def628bb85
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter05.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="TryEnter05.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/Monitor/TryEnter06.cs b/tests/src/baseservices/threading/generics/Monitor/TryEnter06.cs
new file mode 100644
index 0000000000..426b41a37f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter06.cs
@@ -0,0 +1,177 @@
+// 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.Threading;
+
+
+public struct ValX1<T> {}
+public class RefX1<T> {}
+
+struct Gen<T>
+{
+
+ public static void TryEnterTest<U>(bool TisU)
+ {
+ Type monitorT = typeof(Gen<T>);
+ Type monitorU = typeof(Gen<U>);
+
+ TestHelper myHelper = new TestHelper(Test.nThreads);
+ TestHelper myHelper2 = new TestHelper(Test.nThreads);
+ WaitHandle[] myWaiter = new WaitHandle[2];
+ myWaiter[0] = myHelper.m_Event;
+ myWaiter[1] = myHelper2.m_Event;
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ // new MonitorDelegateTS(myHelper.ConsumerTryEnter).BeginInvoke(monitorT,100,null,null);
+ // new MonitorDelegateTS(myHelper2.ConsumerTryEnter).BeginInvoke(monitorU,100,null,null);
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper.ConsumerTryEnter(monitorT, 100);
+ });
+
+ ThreadPool.QueueUserWorkItem(state =>
+ {
+ myHelper2.ConsumerTryEnter(monitorU, 100);
+ });
+ }
+
+ for(int i=0;i<6;i++)
+ {
+ if(WaitHandle.WaitAll(myWaiter,10000))//,true))
+ break;
+ if(myHelper.Error == true || myHelper2.Error == true)
+ break;
+ }
+ Test.Eval(!(myHelper.Error && myHelper2.Error));
+
+ }
+
+
+
+}
+
+public class Test
+{
+ public static int nThreads = 25;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.TryEnterTest<int>(true);
+ Gen<double>.TryEnterTest<int>(false);
+ Gen<string>.TryEnterTest<int>(false);
+ Gen<object>.TryEnterTest<int>(false);
+ Gen<Guid>.TryEnterTest<int>(false);
+ Gen<RefX1<int>>.TryEnterTest<int>(false);
+ Gen<RefX1<string>>.TryEnterTest<int>(false);
+ Gen<ValX1<int>>.TryEnterTest<int>(false);
+ Gen<ValX1<string>>.TryEnterTest<int>(false);
+
+ Gen<int>.TryEnterTest<double>(false);
+ Gen<double>.TryEnterTest<double>(true);
+ Gen<string>.TryEnterTest<double>(false);
+ Gen<object>.TryEnterTest<double>(false);
+ Gen<Guid>.TryEnterTest<double>(false);
+ Gen<RefX1<int>>.TryEnterTest<double>(false);
+ Gen<RefX1<string>>.TryEnterTest<double>(false);
+ Gen<ValX1<int>>.TryEnterTest<double>(false);
+ Gen<ValX1<string>>.TryEnterTest<double>(false);
+
+ Gen<int>.TryEnterTest<string>(false);
+ Gen<double>.TryEnterTest<string>(false);
+ Gen<string>.TryEnterTest<string>(true);
+ Gen<object>.TryEnterTest<string>(false);
+ Gen<Guid>.TryEnterTest<string>(false);
+ Gen<RefX1<int>>.TryEnterTest<string>(false);
+ Gen<RefX1<string>>.TryEnterTest<string>(false);
+ Gen<ValX1<int>>.TryEnterTest<string>(false);
+ Gen<ValX1<string>>.TryEnterTest<string>(false);
+
+ Gen<int>.TryEnterTest<object>(false);
+ Gen<double>.TryEnterTest<object>(false);
+ Gen<string>.TryEnterTest<object>(false);
+ Gen<object>.TryEnterTest<object>(true);
+ Gen<Guid>.TryEnterTest<object>(false);
+ Gen<RefX1<int>>.TryEnterTest<object>(false);
+ Gen<RefX1<string>>.TryEnterTest<object>(false);
+ Gen<ValX1<int>>.TryEnterTest<object>(false);
+ Gen<ValX1<string>>.TryEnterTest<object>(false);
+
+ Gen<int>.TryEnterTest<Guid>(false);
+ Gen<double>.TryEnterTest<Guid>(false);
+ Gen<string>.TryEnterTest<Guid>(false);
+ Gen<object>.TryEnterTest<Guid>(false);
+ Gen<Guid>.TryEnterTest<Guid>(true);
+ Gen<RefX1<int>>.TryEnterTest<Guid>(false);
+ Gen<RefX1<string>>.TryEnterTest<Guid>(false);
+ Gen<ValX1<int>>.TryEnterTest<Guid>(false);
+ Gen<ValX1<string>>.TryEnterTest<Guid>(false);
+
+ Gen<int>.TryEnterTest<RefX1<int>>(false);
+ Gen<double>.TryEnterTest<RefX1<int>>(false);
+ Gen<string>.TryEnterTest<RefX1<int>>(false);
+ Gen<object>.TryEnterTest<RefX1<int>>(false);
+ Gen<Guid>.TryEnterTest<RefX1<int>>(false);
+ Gen<RefX1<int>>.TryEnterTest<RefX1<int>>(true);
+ Gen<RefX1<string>>.TryEnterTest<RefX1<int>>(false);
+ Gen<ValX1<int>>.TryEnterTest<RefX1<int>>(false);
+ Gen<ValX1<string>>.TryEnterTest<RefX1<int>>(false);
+
+ Gen<int>.TryEnterTest<RefX1<string>>(false);
+ Gen<double>.TryEnterTest<RefX1<string>>(false);
+ Gen<string>.TryEnterTest<RefX1<string>>(false);
+ Gen<object>.TryEnterTest<RefX1<string>>(false);
+ Gen<Guid>.TryEnterTest<RefX1<string>>(false);
+ Gen<RefX1<int>>.TryEnterTest<RefX1<string>>(false);
+ Gen<RefX1<string>>.TryEnterTest<RefX1<string>>(true);
+ Gen<ValX1<int>>.TryEnterTest<RefX1<string>>(false);
+ Gen<ValX1<string>>.TryEnterTest<RefX1<string>>(false);
+
+ Gen<int>.TryEnterTest<ValX1<int>>(false);
+ Gen<double>.TryEnterTest<ValX1<int>>(false);
+ Gen<string>.TryEnterTest<ValX1<int>>(false); //offending line
+ Gen<object>.TryEnterTest<ValX1<int>>(false); //offending line
+ Gen<Guid>.TryEnterTest<ValX1<int>>(false);
+ Gen<RefX1<int>>.TryEnterTest<ValX1<int>>(false); //offending line
+ Gen<RefX1<string>>.TryEnterTest<ValX1<int>>(false); //offending line
+ Gen<ValX1<int>>.TryEnterTest<ValX1<int>>(true);
+ Gen<ValX1<string>>.TryEnterTest<ValX1<int>>(false); //offending line
+
+ Gen<int>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<double>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<string>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<object>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<Guid>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<RefX1<int>>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<RefX1<string>>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<ValX1<int>>.TryEnterTest<ValX1<string>>(false); //offending line
+ Gen<ValX1<string>>.TryEnterTest<ValX1<string>>(true); //offending line
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/Monitor/TryEnter06.csproj b/tests/src/baseservices/threading/generics/Monitor/TryEnter06.csproj
new file mode 100644
index 0000000000..041d5be26d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter06.csproj
@@ -0,0 +1,42 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="TryEnter06.cs" />
+ <Compile Include="MonitorHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread01.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread01.cs
new file mode 100644
index 0000000000..ec88c8b394
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread01.cs
@@ -0,0 +1,84 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ Gen<T> obj = new Gen<T>();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0; // was long
+ public static int period = 2; // was long
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread01.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread01.csproj
new file mode 100644
index 0000000000..ce33640b9f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread01.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread02.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread02.cs
new file mode 100644
index 0000000000..0b6319ba6f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread02.cs
@@ -0,0 +1,84 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public virtual void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ Gen<T> obj = new Gen<T>();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread02.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread02.csproj
new file mode 100644
index 0000000000..2c4070edc5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread02.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread03.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread03.cs
new file mode 100644
index 0000000000..2eeeae4338
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread03.cs
@@ -0,0 +1,80 @@
+// 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.Threading;
+
+class Gen
+{
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ Gen obj = new Gen();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread03.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread03.csproj
new file mode 100644
index 0000000000..9efacd2e55
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread03.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread04.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread04.cs
new file mode 100644
index 0000000000..a1fc2a49b3
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread04.cs
@@ -0,0 +1,80 @@
+// 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.Threading;
+
+class Gen
+{
+ public virtual void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ Gen obj = new Gen();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread04.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread04.csproj
new file mode 100644
index 0000000000..c4a425f31f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread04.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread04.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread05.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread05.cs
new file mode 100644
index 0000000000..21fa1f72f3
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread05.cs
@@ -0,0 +1,80 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ Gen<T> obj = new Gen<T>();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int Xcounter = 0;
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread05.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread05.csproj
new file mode 100644
index 0000000000..038a235252
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread05.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread05.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread06.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread06.cs
new file mode 100644
index 0000000000..58b8b74c95
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread06.cs
@@ -0,0 +1,80 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public virtual void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ Gen<T> obj = new Gen<T>();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int Xcounter = 0;
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread06.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread06.csproj
new file mode 100644
index 0000000000..369a3ab6b7
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread06.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread06.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread07.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread07.cs
new file mode 100644
index 0000000000..399f9f565d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread07.cs
@@ -0,0 +1,84 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ Gen<T> obj = new Gen<T>();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread07.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread07.csproj
new file mode 100644
index 0000000000..e8c3b4e577
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread07.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread07.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread08.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread08.cs
new file mode 100644
index 0000000000..641e901bb1
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread08.cs
@@ -0,0 +1,80 @@
+// 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.Threading;
+
+struct Gen
+{
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ Gen obj = new Gen();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread08.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread08.csproj
new file mode 100644
index 0000000000..7eee61e99e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread08.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread08.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread09.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread09.cs
new file mode 100644
index 0000000000..8af00c59d4
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread09.cs
@@ -0,0 +1,80 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ Gen<T> obj = new Gen<T>();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int Xcounter = 0;
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread09.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread09.csproj
new file mode 100644
index 0000000000..5af4c9d6e7
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread09.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread09.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread10.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread10.cs
new file mode 100644
index 0000000000..2a9de822ae
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread10.cs
@@ -0,0 +1,93 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target(object p);
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<T> obj = new Gen<T>();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread10.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread10.csproj
new file mode 100644
index 0000000000..047d5dd745
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread10.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread10.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread11.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread11.cs
new file mode 100644
index 0000000000..e2668ab778
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread11.cs
@@ -0,0 +1,93 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target(object p);
+ T Dummy(T t);
+}
+
+struct Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<T> obj = new Gen<T>();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread11.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread11.csproj
new file mode 100644
index 0000000000..a2b541b609
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread11.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread11.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread12.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread12.cs
new file mode 100644
index 0000000000..a47ec63773
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread12.cs
@@ -0,0 +1,93 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target(object p);
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public virtual void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<T> obj = new Gen<T>();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread12.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread12.csproj
new file mode 100644
index 0000000000..fa3fd88273
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread12.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread12.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread13.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread13.cs
new file mode 100644
index 0000000000..5b10a323bf
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread13.cs
@@ -0,0 +1,219 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target(object p);
+ T Dummy(T t);
+}
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<int> obj = new GenInt();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<double> obj = new GenDouble();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<string> obj = new GenString();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<object> obj = new GenObject();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<Guid> obj = new GenGuid();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest();
+ GenDouble.ThreadPoolTest();
+ GenString.ThreadPoolTest();
+ GenObject.ThreadPoolTest();
+ GenGuid.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread13.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread13.csproj
new file mode 100644
index 0000000000..4fbaf3afd4
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread13.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread13.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread14.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread14.cs
new file mode 100644
index 0000000000..0f784fe964
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread14.cs
@@ -0,0 +1,219 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target(object p);
+ T Dummy(T t);
+}
+
+struct GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<int> obj = new GenInt();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<double> obj = new GenDouble();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<string> obj = new GenString();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<object> obj = new GenObject();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<Guid> obj = new GenGuid();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest();
+ GenDouble.ThreadPoolTest();
+ GenString.ThreadPoolTest();
+ GenObject.ThreadPoolTest();
+ GenGuid.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread14.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread14.csproj
new file mode 100644
index 0000000000..fec7ca9388
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread14.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread14.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread15.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread15.cs
new file mode 100644
index 0000000000..1af5326a7c
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread15.cs
@@ -0,0 +1,219 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target(object p);
+ T Dummy(T t);
+}
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public virtual void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<int> obj = new GenInt();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public virtual void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<double> obj = new GenDouble();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public virtual void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<string> obj = new GenString();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public virtual void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<object> obj = new GenObject();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public virtual void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<Guid> obj = new GenGuid();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest();
+ GenDouble.ThreadPoolTest();
+ GenString.ThreadPoolTest();
+ GenObject.ThreadPoolTest();
+ GenGuid.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread15.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread15.csproj
new file mode 100644
index 0000000000..186b84536d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread15.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread15.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread16.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread16.cs
new file mode 100644
index 0000000000..192227c641
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread16.cs
@@ -0,0 +1,85 @@
+// 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.Threading;
+
+interface IGen
+{
+ void Target<U>(object p);
+}
+
+class Gen : IGen
+{
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen obj = new Gen();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread16.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread16.csproj
new file mode 100644
index 0000000000..3e19a1cdcd
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread16.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread16.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread17.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread17.cs
new file mode 100644
index 0000000000..c5797b2434
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread17.cs
@@ -0,0 +1,85 @@
+// 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.Threading;
+
+interface IGen
+{
+ void Target<U>(object p);
+}
+
+struct Gen : IGen
+{
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen obj = new Gen();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread17.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread17.csproj
new file mode 100644
index 0000000000..6a1044e621
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread17.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread17.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread18.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread18.cs
new file mode 100644
index 0000000000..6e1db0802a
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread18.cs
@@ -0,0 +1,85 @@
+// 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.Threading;
+
+interface IGen
+{
+ void Target<U>(object p);
+}
+
+class Gen : IGen
+{
+ public virtual void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen obj = new Gen();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread18.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread18.csproj
new file mode 100644
index 0000000000..137b2c9b4e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread18.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread18.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread19.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread19.cs
new file mode 100644
index 0000000000..039914a792
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread19.cs
@@ -0,0 +1,89 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target<U>(object p);
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<T> obj = new Gen<T>();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread19.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread19.csproj
new file mode 100644
index 0000000000..dcf2f7860c
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread19.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread19.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread20.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread20.cs
new file mode 100644
index 0000000000..de828c39de
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread20.cs
@@ -0,0 +1,89 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target<U>(object p);
+ T Dummy(T t);
+}
+
+struct Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<T> obj = new Gen<T>();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread20.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread20.csproj
new file mode 100644
index 0000000000..faaeece6a7
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread20.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread20.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread21.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread21.cs
new file mode 100644
index 0000000000..a62088d444
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread21.cs
@@ -0,0 +1,89 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target<U>(object p);
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public virtual void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<T> obj = new Gen<T>();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread21.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread21.csproj
new file mode 100644
index 0000000000..1996239dc9
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread21.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread21.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread22.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread22.cs
new file mode 100644
index 0000000000..e5bbf61fc8
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread22.cs
@@ -0,0 +1,243 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target<U>(object p);
+ T Dummy(T t);
+}
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<int> obj = new GenInt();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<double> obj = new GenDouble();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<string> obj = new GenString();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<object> obj = new GenObject();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<Guid> obj = new GenGuid();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest<int>();
+ GenDouble.ThreadPoolTest<int>();
+ GenString.ThreadPoolTest<int>();
+ GenObject.ThreadPoolTest<int>();
+ GenGuid.ThreadPoolTest<int>();
+
+ GenInt.ThreadPoolTest<double>();
+ GenDouble.ThreadPoolTest<double>();
+ GenString.ThreadPoolTest<double>();
+ GenObject.ThreadPoolTest<double>();
+ GenGuid.ThreadPoolTest<double>();
+
+ GenInt.ThreadPoolTest<string>();
+ GenDouble.ThreadPoolTest<string>();
+ GenString.ThreadPoolTest<string>();
+ GenObject.ThreadPoolTest<string>();
+ GenGuid.ThreadPoolTest<string>();
+
+ GenInt.ThreadPoolTest<object>();
+ GenDouble.ThreadPoolTest<object>();
+ GenString.ThreadPoolTest<object>();
+ GenObject.ThreadPoolTest<object>();
+ GenGuid.ThreadPoolTest<object>();
+
+ GenInt.ThreadPoolTest<Guid>();
+ GenDouble.ThreadPoolTest<Guid>();
+ GenString.ThreadPoolTest<Guid>();
+ GenObject.ThreadPoolTest<Guid>();
+ GenGuid.ThreadPoolTest<Guid>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread22.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread22.csproj
new file mode 100644
index 0000000000..19e7597fb6
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread22.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread22.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread23.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread23.cs
new file mode 100644
index 0000000000..e487131612
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread23.cs
@@ -0,0 +1,243 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target<U>(object p);
+ T Dummy(T t);
+}
+
+struct GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<int> obj = new GenInt();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<double> obj = new GenDouble();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<string> obj = new GenString();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<object> obj = new GenObject();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<Guid> obj = new GenGuid();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest<int>();
+ GenDouble.ThreadPoolTest<int>();
+ GenString.ThreadPoolTest<int>();
+ GenObject.ThreadPoolTest<int>();
+ GenGuid.ThreadPoolTest<int>();
+
+ GenInt.ThreadPoolTest<double>();
+ GenDouble.ThreadPoolTest<double>();
+ GenString.ThreadPoolTest<double>();
+ GenObject.ThreadPoolTest<double>();
+ GenGuid.ThreadPoolTest<double>();
+
+ GenInt.ThreadPoolTest<string>();
+ GenDouble.ThreadPoolTest<string>();
+ GenString.ThreadPoolTest<string>();
+ GenObject.ThreadPoolTest<string>();
+ GenGuid.ThreadPoolTest<string>();
+
+ GenInt.ThreadPoolTest<object>();
+ GenDouble.ThreadPoolTest<object>();
+ GenString.ThreadPoolTest<object>();
+ GenObject.ThreadPoolTest<object>();
+ GenGuid.ThreadPoolTest<object>();
+
+ GenInt.ThreadPoolTest<Guid>();
+ GenDouble.ThreadPoolTest<Guid>();
+ GenString.ThreadPoolTest<Guid>();
+ GenObject.ThreadPoolTest<Guid>();
+ GenGuid.ThreadPoolTest<Guid>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread23.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread23.csproj
new file mode 100644
index 0000000000..64f663730e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread23.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread23.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread24.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread24.cs
new file mode 100644
index 0000000000..86fd7a090f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread24.cs
@@ -0,0 +1,243 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target<U>(object p);
+ T Dummy(T t);
+}
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public virtual void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<int> obj = new GenInt();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public virtual void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<double> obj = new GenDouble();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public virtual void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<string> obj = new GenString();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public virtual void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<object> obj = new GenObject();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public virtual void Target<U>(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ IGen<Guid> obj = new GenGuid();
+
+ TimerCallback tcb = new TimerCallback(obj.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest<int>();
+ GenDouble.ThreadPoolTest<int>();
+ GenString.ThreadPoolTest<int>();
+ GenObject.ThreadPoolTest<int>();
+ GenGuid.ThreadPoolTest<int>();
+
+ GenInt.ThreadPoolTest<double>();
+ GenDouble.ThreadPoolTest<double>();
+ GenString.ThreadPoolTest<double>();
+ GenObject.ThreadPoolTest<double>();
+ GenGuid.ThreadPoolTest<double>();
+
+ GenInt.ThreadPoolTest<string>();
+ GenDouble.ThreadPoolTest<string>();
+ GenString.ThreadPoolTest<string>();
+ GenObject.ThreadPoolTest<string>();
+ GenGuid.ThreadPoolTest<string>();
+
+ GenInt.ThreadPoolTest<object>();
+ GenDouble.ThreadPoolTest<object>();
+ GenString.ThreadPoolTest<object>();
+ GenObject.ThreadPoolTest<object>();
+ GenGuid.ThreadPoolTest<object>();
+
+ GenInt.ThreadPoolTest<Guid>();
+ GenDouble.ThreadPoolTest<Guid>();
+ GenString.ThreadPoolTest<Guid>();
+ GenObject.ThreadPoolTest<Guid>();
+ GenGuid.ThreadPoolTest<Guid>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread24.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread24.csproj
new file mode 100644
index 0000000000..b8b24b0051
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread24.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread24.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread25.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread25.cs
new file mode 100644
index 0000000000..77a242e97f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread25.cs
@@ -0,0 +1,82 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public static void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ TimerCallback tcb = new TimerCallback(Gen<T>.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread25.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread25.csproj
new file mode 100644
index 0000000000..50553c69a0
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread25.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread25.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread26.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread26.cs
new file mode 100644
index 0000000000..2caf79a4ba
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread26.cs
@@ -0,0 +1,82 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public static void Target(object p)
+ {
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ TimerCallback tcb = new TimerCallback(Gen<T>.Target);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread26.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread26.csproj
new file mode 100644
index 0000000000..a943885011
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread26.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread26.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread27.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread27.cs
new file mode 100644
index 0000000000..b9e422f628
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread27.cs
@@ -0,0 +1,78 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public static void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ TimerCallback tcb = new TimerCallback(Gen<T>.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread27.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread27.csproj
new file mode 100644
index 0000000000..f991df64be
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread27.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread27.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread28.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread28.cs
new file mode 100644
index 0000000000..77e0d6e21a
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread28.cs
@@ -0,0 +1,78 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public static void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ TimerCallback tcb = new TimerCallback(Gen<T>.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread28.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread28.csproj
new file mode 100644
index 0000000000..88016dee2d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread28.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread28.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread29.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread29.cs
new file mode 100644
index 0000000000..0286f4bb17
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread29.cs
@@ -0,0 +1,78 @@
+// 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.Threading;
+
+class Gen
+{
+ public static void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ TimerCallback tcb = new TimerCallback(Gen.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread29.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread29.csproj
new file mode 100644
index 0000000000..4650523f8b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread29.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread29.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread30.cs b/tests/src/baseservices/threading/generics/TimerCallback/thread30.cs
new file mode 100644
index 0000000000..56676fb7b1
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread30.cs
@@ -0,0 +1,78 @@
+// 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.Threading;
+
+struct Gen
+{
+ public static void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ if (Test.Xcounter>=Test.nThreads)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ evt.Set();
+ }
+ else
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent evt = new ManualResetEvent(false);
+
+ TimerCallback tcb = new TimerCallback(Gen.Target<U>);
+ Timer timer = new Timer(tcb,evt,Test.delay,Test.period);
+
+ evt.WaitOne();
+ timer.Dispose();
+ Test.Eval(Test.Xcounter>=Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 2;
+ public static int nThreads = 5;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/thread30.csproj b/tests/src/baseservices/threading/generics/TimerCallback/thread30.csproj
new file mode 100644
index 0000000000..d458fca31b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread30.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread30.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/tighttimercallback.cs b/tests/src/baseservices/threading/generics/TimerCallback/tighttimercallback.cs
new file mode 100644
index 0000000000..80635a1afe
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/tighttimercallback.cs
@@ -0,0 +1,91 @@
+// 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.Threading;
+using System.Diagnostics;
+
+//namespace TimerCallbackTests ////////////// added this namesp
+
+class Gen<T>
+{
+ public static Type objType;
+
+ public void Target(object p)
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ if (p.GetType() != objType)
+ {
+ Test.result = false;
+ Console.WriteLine("Expected parameter type: " + objType + ", but found type: " + p.GetType());
+ }
+
+ if (this.GetType() != objType)
+ {
+ Test.result = false;
+ Console.WriteLine("Expected this type: " + objType + ", but found type: " + this.GetType());
+ }
+
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Gen<T> obj = new Gen<T>();
+ objType = obj.GetType();
+
+ TimerCallback tcb = new TimerCallback(obj.Target);
+ Stopwatch testWatch = new Stopwatch();
+ testWatch.Start();
+ Timer timer = new Timer(tcb,obj,Test.delay,Test.period);
+ while (testWatch.ElapsedMilliseconds < Test.timeToRun)
+ {
+ Thread.Sleep(0);
+ }
+
+ timer.Dispose();
+ testWatch.Stop();
+
+ if (Test.Xcounter > ((testWatch.ElapsedMilliseconds / Test.period)+2))
+ {
+ Test.result = false;
+ Console.WriteLine("Expected Timer to run at most " + ((testWatch.ElapsedMilliseconds / Test.period)+2) + " times, but found " + Test.Xcounter + " runs in " + obj.GetType() + " type object.");
+ }
+
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int delay = 0;
+ public static int period = 30;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static int timeToRun = 5000;
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/tighttimercallback.csproj b/tests/src/baseservices/threading/generics/TimerCallback/tighttimercallback.csproj
new file mode 100644
index 0000000000..31ce9cf85a
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/tighttimercallback.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="tighttimercallback.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread01.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread01.cs
new file mode 100644
index 0000000000..f253494a3d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread01.cs
@@ -0,0 +1,84 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ Gen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread01.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread01.csproj
new file mode 100644
index 0000000000..ce33640b9f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread01.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread02.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread02.cs
new file mode 100644
index 0000000000..14e58e834a
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread02.cs
@@ -0,0 +1,84 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public virtual void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ Gen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread02.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread02.csproj
new file mode 100644
index 0000000000..2c4070edc5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread02.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread03.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread03.cs
new file mode 100644
index 0000000000..2ca4aa49b5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread03.cs
@@ -0,0 +1,80 @@
+// 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.Threading;
+
+class Gen
+{
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ Gen obj = new Gen();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread03.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread03.csproj
new file mode 100644
index 0000000000..9efacd2e55
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread03.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread04.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread04.cs
new file mode 100644
index 0000000000..de952fe2bb
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread04.cs
@@ -0,0 +1,80 @@
+// 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.Threading;
+
+class Gen
+{
+ public virtual void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ Gen obj = new Gen();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread04.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread04.csproj
new file mode 100644
index 0000000000..c4a425f31f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread04.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread04.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread05.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread05.cs
new file mode 100644
index 0000000000..504ec78a10
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread05.cs
@@ -0,0 +1,80 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ Gen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread05.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread05.csproj
new file mode 100644
index 0000000000..038a235252
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread05.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread05.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread06.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread06.cs
new file mode 100644
index 0000000000..d5b71c33f0
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread06.cs
@@ -0,0 +1,80 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public virtual void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ Gen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread06.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread06.csproj
new file mode 100644
index 0000000000..369a3ab6b7
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread06.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread06.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread07.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread07.cs
new file mode 100644
index 0000000000..28f2e3864f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread07.cs
@@ -0,0 +1,84 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ Gen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread07.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread07.csproj
new file mode 100644
index 0000000000..e8c3b4e577
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread07.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread07.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread08.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread08.cs
new file mode 100644
index 0000000000..95712b22f0
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread08.cs
@@ -0,0 +1,80 @@
+// 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.Threading;
+
+struct Gen
+{
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ Gen obj = new Gen();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread08.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread08.csproj
new file mode 100644
index 0000000000..7eee61e99e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread08.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread08.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread09.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread09.cs
new file mode 100644
index 0000000000..6f2d737d5e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread09.cs
@@ -0,0 +1,80 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ Gen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread09.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread09.csproj
new file mode 100644
index 0000000000..5af4c9d6e7
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread09.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread09.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread10.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread10.cs
new file mode 100644
index 0000000000..bd0f595ca9
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread10.cs
@@ -0,0 +1,94 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target(object p);
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<T> obj = new Gen<T>();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread10.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread10.csproj
new file mode 100644
index 0000000000..047d5dd745
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread10.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread10.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread11.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread11.cs
new file mode 100644
index 0000000000..d835dfc7db
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread11.cs
@@ -0,0 +1,94 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target(object p);
+ T Dummy(T t);
+}
+
+struct Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<T> obj = new Gen<T>();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread11.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread11.csproj
new file mode 100644
index 0000000000..a2b541b609
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread11.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread11.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread12.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread12.cs
new file mode 100644
index 0000000000..82be6836ea
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread12.cs
@@ -0,0 +1,94 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target(object p);
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public virtual void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<T> obj = new Gen<T>();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread12.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread12.csproj
new file mode 100644
index 0000000000..fa3fd88273
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread12.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread12.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread13.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread13.cs
new file mode 100644
index 0000000000..e13a83d20e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread13.cs
@@ -0,0 +1,236 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target(object p);
+ T Dummy(T t);
+}
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<int> obj = new GenInt();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<double> obj = new GenDouble();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<string> obj = new GenString();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<object> obj = new GenObject();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<Guid> obj = new GenGuid();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest();
+ GenDouble.ThreadPoolTest();
+ GenString.ThreadPoolTest();
+ GenObject.ThreadPoolTest();
+ GenGuid.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread13.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread13.csproj
new file mode 100644
index 0000000000..4fbaf3afd4
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread13.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread13.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread14.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread14.cs
new file mode 100644
index 0000000000..fa68b5cf06
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread14.cs
@@ -0,0 +1,236 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target(object p);
+ T Dummy(T t);
+}
+
+struct GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<int> obj = new GenInt();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<double> obj = new GenDouble();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+
+struct GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<string> obj = new GenString();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<object> obj = new GenObject();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<Guid> obj = new GenGuid();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest();
+ GenDouble.ThreadPoolTest();
+ GenString.ThreadPoolTest();
+ GenObject.ThreadPoolTest();
+ GenGuid.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread14.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread14.csproj
new file mode 100644
index 0000000000..fec7ca9388
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread14.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread14.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread15.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread15.cs
new file mode 100644
index 0000000000..75b7aa3a2e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread15.cs
@@ -0,0 +1,236 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target(object p);
+ T Dummy(T t);
+}
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public virtual void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<int> obj = new GenInt();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public virtual void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<double> obj = new GenDouble();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public virtual void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<string> obj = new GenString();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public virtual void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<object> obj = new GenObject();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public virtual void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<Guid> obj = new GenGuid();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest();
+ GenDouble.ThreadPoolTest();
+ GenString.ThreadPoolTest();
+ GenObject.ThreadPoolTest();
+ GenGuid.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread15.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread15.csproj
new file mode 100644
index 0000000000..186b84536d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread15.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread15.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread16.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread16.cs
new file mode 100644
index 0000000000..48e906b9f5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread16.cs
@@ -0,0 +1,85 @@
+// 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.Threading;
+
+interface IGen
+{
+ void Target<U>(object p);
+}
+
+class Gen : IGen
+{
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen obj = new Gen();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread16.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread16.csproj
new file mode 100644
index 0000000000..3e19a1cdcd
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread16.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread16.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread17.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread17.cs
new file mode 100644
index 0000000000..b51bd27627
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread17.cs
@@ -0,0 +1,85 @@
+// 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.Threading;
+
+interface IGen
+{
+ void Target<U>(object p);
+}
+
+struct Gen : IGen
+{
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen obj = new Gen();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread17.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread17.csproj
new file mode 100644
index 0000000000..6a1044e621
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread17.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread17.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread18.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread18.cs
new file mode 100644
index 0000000000..e8f989609a
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread18.cs
@@ -0,0 +1,85 @@
+// 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.Threading;
+
+interface IGen
+{
+ void Target<U>(object p);
+}
+
+class Gen : IGen
+{
+ public virtual void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen obj = new Gen();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread18.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread18.csproj
new file mode 100644
index 0000000000..137b2c9b4e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread18.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread18.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread19.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread19.cs
new file mode 100644
index 0000000000..9a295c0fca
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread19.cs
@@ -0,0 +1,89 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target<U>(object p);
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) {return t;}
+
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread19.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread19.csproj
new file mode 100644
index 0000000000..dcf2f7860c
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread19.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread19.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread20.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread20.cs
new file mode 100644
index 0000000000..c6a19a14d0
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread20.cs
@@ -0,0 +1,89 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target<U>(object p);
+ T Dummy(T t);
+}
+
+struct Gen<T> : IGen<T>
+{
+ public T Dummy(T t) {return t;}
+
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread20.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread20.csproj
new file mode 100644
index 0000000000..faaeece6a7
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread20.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread20.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread21.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread21.cs
new file mode 100644
index 0000000000..e6c0f6dbe4
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread21.cs
@@ -0,0 +1,89 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target<U>(object p);
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) {return t;}
+
+ public virtual void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread21.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread21.csproj
new file mode 100644
index 0000000000..1996239dc9
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread21.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread21.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread22.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread22.cs
new file mode 100644
index 0000000000..ef2c656de2
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread22.cs
@@ -0,0 +1,271 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target<U>(object p);
+ T Dummy(T t);
+}
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<int> obj = new GenInt();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<double> obj = new GenDouble();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<string> obj = new GenString();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<object> obj = new GenObject();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<Guid> obj = new GenGuid();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest<int>();
+ GenDouble.ThreadPoolTest<int>();
+ GenString.ThreadPoolTest<int>();
+ GenObject.ThreadPoolTest<int>();
+ GenGuid.ThreadPoolTest<int>();
+
+ GenInt.ThreadPoolTest<double>();
+ GenDouble.ThreadPoolTest<double>();
+ GenString.ThreadPoolTest<double>();
+ GenObject.ThreadPoolTest<double>();
+ GenGuid.ThreadPoolTest<double>();
+
+ GenInt.ThreadPoolTest<string>();
+ GenDouble.ThreadPoolTest<string>();
+ GenString.ThreadPoolTest<string>();
+ GenObject.ThreadPoolTest<string>();
+ GenGuid.ThreadPoolTest<string>();
+
+ GenInt.ThreadPoolTest<object>();
+ GenDouble.ThreadPoolTest<object>();
+ GenString.ThreadPoolTest<object>();
+ GenObject.ThreadPoolTest<object>();
+ GenGuid.ThreadPoolTest<object>();
+
+ GenInt.ThreadPoolTest<Guid>();
+ GenDouble.ThreadPoolTest<Guid>();
+ GenString.ThreadPoolTest<Guid>();
+ GenObject.ThreadPoolTest<Guid>();
+ GenGuid.ThreadPoolTest<Guid>();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread22.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread22.csproj
new file mode 100644
index 0000000000..19e7597fb6
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread22.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread22.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread23.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread23.cs
new file mode 100644
index 0000000000..7df7392a64
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread23.cs
@@ -0,0 +1,269 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target<U>(object p);
+ T Dummy(T t);
+}
+
+struct GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<int> obj = new GenInt();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<double> obj = new GenDouble();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+
+struct GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<string> obj = new GenString();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<object> obj = new GenObject();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<Guid> obj = new GenGuid();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest<int>();
+ GenDouble.ThreadPoolTest<int>();
+ GenString.ThreadPoolTest<int>();
+ GenObject.ThreadPoolTest<int>();
+ GenGuid.ThreadPoolTest<int>();
+
+ GenInt.ThreadPoolTest<double>();
+ GenDouble.ThreadPoolTest<double>();
+ GenString.ThreadPoolTest<double>();
+ GenObject.ThreadPoolTest<double>();
+ GenGuid.ThreadPoolTest<double>();
+
+ GenInt.ThreadPoolTest<string>();
+ GenDouble.ThreadPoolTest<string>();
+ GenString.ThreadPoolTest<string>();
+ GenObject.ThreadPoolTest<string>();
+ GenGuid.ThreadPoolTest<string>();
+
+ GenInt.ThreadPoolTest<object>();
+ GenDouble.ThreadPoolTest<object>();
+ GenString.ThreadPoolTest<object>();
+ GenObject.ThreadPoolTest<object>();
+ GenGuid.ThreadPoolTest<object>();
+
+ GenInt.ThreadPoolTest<Guid>();
+ GenDouble.ThreadPoolTest<Guid>();
+ GenString.ThreadPoolTest<Guid>();
+ GenObject.ThreadPoolTest<Guid>();
+ GenGuid.ThreadPoolTest<Guid>();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread23.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread23.csproj
new file mode 100644
index 0000000000..64f663730e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread23.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread23.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread24.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread24.cs
new file mode 100644
index 0000000000..ca6bfc33fd
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread24.cs
@@ -0,0 +1,267 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target<U>(object p);
+ T Dummy(T t);
+}
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public virtual void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<int> obj = new GenInt();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public virtual void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<double> obj = new GenDouble();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public virtual void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<string> obj = new GenString();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public virtual void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<object> obj = new GenObject();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public virtual void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ IGen<Guid> obj = new GenGuid();
+
+ for (int i = 0; i <Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(obj.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest<int>();
+ GenDouble.ThreadPoolTest<int>();
+ GenString.ThreadPoolTest<int>();
+ GenObject.ThreadPoolTest<int>();
+ GenGuid.ThreadPoolTest<int>();
+
+ GenInt.ThreadPoolTest<double>();
+ GenDouble.ThreadPoolTest<double>();
+ GenString.ThreadPoolTest<double>();
+ GenObject.ThreadPoolTest<double>();
+ GenGuid.ThreadPoolTest<double>();
+
+ GenInt.ThreadPoolTest<string>();
+ GenDouble.ThreadPoolTest<string>();
+ GenString.ThreadPoolTest<string>();
+ GenObject.ThreadPoolTest<string>();
+ GenGuid.ThreadPoolTest<string>();
+
+ GenInt.ThreadPoolTest<object>();
+ GenDouble.ThreadPoolTest<object>();
+ GenString.ThreadPoolTest<object>();
+ GenObject.ThreadPoolTest<object>();
+ GenGuid.ThreadPoolTest<object>();
+
+ GenInt.ThreadPoolTest<Guid>();
+ GenDouble.ThreadPoolTest<Guid>();
+ GenString.ThreadPoolTest<Guid>();
+ GenObject.ThreadPoolTest<Guid>();
+ GenGuid.ThreadPoolTest<Guid>();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread24.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread24.csproj
new file mode 100644
index 0000000000..b8b24b0051
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread24.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread24.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread25.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread25.cs
new file mode 100644
index 0000000000..973231f41b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread25.cs
@@ -0,0 +1,84 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public static void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ Gen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(Gen<T>.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread25.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread25.csproj
new file mode 100644
index 0000000000..50553c69a0
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread25.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread25.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread26.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread26.cs
new file mode 100644
index 0000000000..7cc3dce282
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread26.cs
@@ -0,0 +1,86 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public static void Target(object p)
+ {
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+#pragma warning disable 219
+ Gen<T> obj = new Gen<T>();
+#pragma warning restore
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(Gen<T>.Target);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread26.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread26.csproj
new file mode 100644
index 0000000000..a943885011
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread26.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread26.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread27.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread27.cs
new file mode 100644
index 0000000000..bbe99f4cdf
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread27.cs
@@ -0,0 +1,80 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public static void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ Gen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(Gen<T>.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread27.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread27.csproj
new file mode 100644
index 0000000000..f991df64be
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread27.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread27.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread28.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread28.cs
new file mode 100644
index 0000000000..ac48e97abf
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread28.cs
@@ -0,0 +1,80 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public static void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+#pragma warning disable 219
+ Gen<T> obj = new Gen<T>();
+#pragma warning restore
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(Gen<T>.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread28.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread28.csproj
new file mode 100644
index 0000000000..88016dee2d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread28.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread28.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread29.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread29.cs
new file mode 100644
index 0000000000..6963728164
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread29.cs
@@ -0,0 +1,78 @@
+// 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.Threading;
+
+class Gen
+{
+ public static void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(Gen.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread29.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread29.csproj
new file mode 100644
index 0000000000..4650523f8b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread29.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread29.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread30.cs b/tests/src/baseservices/threading/generics/WaitCallback/thread30.cs
new file mode 100644
index 0000000000..ef14e682ed
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread30.cs
@@ -0,0 +1,78 @@
+// 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.Threading;
+
+struct Gen
+{
+ public static void Target<U>(object p)
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=p.GetType());
+ ManualResetEvent evt = (ManualResetEvent) p;
+ Interlocked.Increment(ref Test.Xcounter);
+ evt.Set();
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ ManualResetEvent[] evts = new ManualResetEvent[Test.nThreads];
+ WaitHandle[] hdls = new WaitHandle[Test.nThreads];
+
+ for (int i=0; i<Test.nThreads; i++)
+ {
+ evts[i] = new ManualResetEvent(false);
+ hdls[i] = (WaitHandle) evts[i];
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ WaitCallback cb = new WaitCallback(Gen.Target<U>);
+ ThreadPool.QueueUserWorkItem(cb,evts[i]);
+ }
+
+ WaitHandle.WaitAll(hdls);
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/WaitCallback/thread30.csproj b/tests/src/baseservices/threading/generics/WaitCallback/thread30.csproj
new file mode 100644
index 0000000000..d458fca31b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread30.csproj
@@ -0,0 +1,41 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{a1f1c234-d043-412e-bae9-36a26936dab5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread30.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread01.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread01.csproj
new file mode 100644
index 0000000000..c698a228fc
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread01.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread02.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread02.csproj
new file mode 100644
index 0000000000..d85759edda
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread02.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread03.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread03.csproj
new file mode 100644
index 0000000000..4b7e397537
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread03.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread04.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread04.csproj
new file mode 100644
index 0000000000..d57dadc72f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread04.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread04.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread05.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread05.csproj
new file mode 100644
index 0000000000..31d8753c1c
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread05.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread05.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread06.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread06.csproj
new file mode 100644
index 0000000000..3cd6365782
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread06.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread06.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread07.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread07.csproj
new file mode 100644
index 0000000000..cbef961f0a
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread07.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread07.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread08.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread08.csproj
new file mode 100644
index 0000000000..dc56ae4f5c
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread08.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread08.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread09.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread09.csproj
new file mode 100644
index 0000000000..509746e2c5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread09.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread09.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread10.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread10.csproj
new file mode 100644
index 0000000000..cacd4c4367
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread10.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread10.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread11.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread11.csproj
new file mode 100644
index 0000000000..0ecce49865
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread11.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread11.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread12.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread12.csproj
new file mode 100644
index 0000000000..7a4973aa71
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread12.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread12.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread13.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread13.csproj
new file mode 100644
index 0000000000..a97a685367
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread13.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread13.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread14.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread14.csproj
new file mode 100644
index 0000000000..18e5d7445c
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread14.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread14.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread15.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread15.csproj
new file mode 100644
index 0000000000..584cae692e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread15.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread15.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread16.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread16.csproj
new file mode 100644
index 0000000000..d845ee3385
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread16.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread16.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread17.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread17.csproj
new file mode 100644
index 0000000000..d20243abaa
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread17.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread17.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread18.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread18.csproj
new file mode 100644
index 0000000000..6cdb760ef9
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread18.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread18.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread19.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread19.csproj
new file mode 100644
index 0000000000..cc22171d44
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread19.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread19.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread20.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread20.csproj
new file mode 100644
index 0000000000..4e11b3384f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread20.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread20.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread21.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread21.csproj
new file mode 100644
index 0000000000..3763936378
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread21.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread21.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread22.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread22.csproj
new file mode 100644
index 0000000000..38aa2c006b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread22.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread22.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread23.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread23.csproj
new file mode 100644
index 0000000000..168d26be22
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread23.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread23.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread24.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread24.csproj
new file mode 100644
index 0000000000..97a83d5f35
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread24.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread24.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread25.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread25.csproj
new file mode 100644
index 0000000000..d7d9165a12
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread25.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread25.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread26.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread26.csproj
new file mode 100644
index 0000000000..e099a14795
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread26.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread26.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread27.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread27.csproj
new file mode 100644
index 0000000000..294e901611
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread27.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread27.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread28.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread28.csproj
new file mode 100644
index 0000000000..69b40e9924
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread28.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread28.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread29.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread29.csproj
new file mode 100644
index 0000000000..180dfcead0
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread29.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread29.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/GThread30.csproj b/tests/src/baseservices/threading/generics/syncdelegate/GThread30.csproj
new file mode 100644
index 0000000000..58e4b71fbd
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/GThread30.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread30.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread01.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread01.cs
new file mode 100644
index 0000000000..b407d93f2f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread01.cs
@@ -0,0 +1,66 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest()
+ {
+ ThreadStart d = new ThreadStart(new Gen<T>().Target);
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest();
+ Gen<double>.DelegateTest();
+ Gen<string>.DelegateTest();
+ Gen<object>.DelegateTest();
+ Gen<Guid>.DelegateTest();
+
+ Gen<int[]>.DelegateTest();
+ Gen<double[,]>.DelegateTest();
+ Gen<string[][][]>.DelegateTest();
+ Gen<object[,,,]>.DelegateTest();
+ Gen<Guid[][,,,][]>.DelegateTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread02.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread02.cs
new file mode 100644
index 0000000000..3e2525eb05
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread02.cs
@@ -0,0 +1,66 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public virtual void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest()
+ {
+ ThreadStart d = new ThreadStart(new Gen<T>().Target);
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest();
+ Gen<double>.DelegateTest();
+ Gen<string>.DelegateTest();
+ Gen<object>.DelegateTest();
+ Gen<Guid>.DelegateTest();
+
+ Gen<int[]>.DelegateTest();
+ Gen<double[,]>.DelegateTest();
+ Gen<string[][][]>.DelegateTest();
+ Gen<object[,,,]>.DelegateTest();
+ Gen<Guid[][,,,][]>.DelegateTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread03.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread03.cs
new file mode 100644
index 0000000000..25cf299b21
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread03.cs
@@ -0,0 +1,62 @@
+// 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.Threading;
+
+class Gen
+{
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ ThreadStart d = new ThreadStart(new Gen().Target<U>);
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.DelegateTest<object>();
+ Gen.DelegateTest<string>();
+ Gen.DelegateTest<Guid>();
+ Gen.DelegateTest<int>();
+ Gen.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread04.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread04.cs
new file mode 100644
index 0000000000..28fbf55054
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread04.cs
@@ -0,0 +1,64 @@
+// 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.Threading;
+
+class Gen
+{
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ ThreadStart d = new ThreadStart(new Gen().Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.DelegateTest<object>();
+ Gen.DelegateTest<string>();
+ Gen.DelegateTest<Guid>();
+ Gen.DelegateTest<int>();
+ Gen.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread05.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread05.cs
new file mode 100644
index 0000000000..8f88334cdb
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread05.cs
@@ -0,0 +1,64 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ ThreadStart d = new ThreadStart(new Gen<T>().Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest<object>();
+ Gen<double>.DelegateTest<string>();
+ Gen<string>.DelegateTest<Guid>();
+ Gen<object>.DelegateTest<int>();
+ Gen<Guid>.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread06.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread06.cs
new file mode 100644
index 0000000000..1554faf560
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread06.cs
@@ -0,0 +1,64 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ ThreadStart d = new ThreadStart(new Gen<T>().Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest<object>();
+ Gen<double>.DelegateTest<string>();
+ Gen<string>.DelegateTest<Guid>();
+ Gen<object>.DelegateTest<int>();
+ Gen<Guid>.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread07.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread07.cs
new file mode 100644
index 0000000000..d0c0319b60
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread07.cs
@@ -0,0 +1,68 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest()
+ {
+ ThreadStart d = new ThreadStart(new Gen<T>().Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest();
+ Gen<double>.DelegateTest();
+ Gen<string>.DelegateTest();
+ Gen<object>.DelegateTest();
+ Gen<Guid>.DelegateTest();
+
+ Gen<int[]>.DelegateTest();
+ Gen<double[,]>.DelegateTest();
+ Gen<string[][][]>.DelegateTest();
+ Gen<object[,,,]>.DelegateTest();
+ Gen<Guid[][,,,][]>.DelegateTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread08.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread08.cs
new file mode 100644
index 0000000000..b133e31337
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread08.cs
@@ -0,0 +1,64 @@
+// 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.Threading;
+
+struct Gen
+{
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ ThreadStart d = new ThreadStart(new Gen().Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.DelegateTest<object>();
+ Gen.DelegateTest<string>();
+ Gen.DelegateTest<Guid>();
+ Gen.DelegateTest<int>();
+ Gen.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread09.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread09.cs
new file mode 100644
index 0000000000..c91e538f47
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread09.cs
@@ -0,0 +1,64 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ ThreadStart d = new ThreadStart(new Gen<T>().Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest<object>();
+ Gen<double>.DelegateTest<string>();
+ Gen<string>.DelegateTest<Guid>();
+ Gen<object>.DelegateTest<int>();
+ Gen<Guid>.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread10.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread10.cs
new file mode 100644
index 0000000000..1a09ce56ed
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread10.cs
@@ -0,0 +1,79 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target();
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<T> obj = new Gen<T>();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest();
+ Gen<double>.DelegateTest();
+ Gen<string>.DelegateTest();
+ Gen<object>.DelegateTest();
+ Gen<Guid>.DelegateTest();
+
+ Gen<int[]>.DelegateTest();
+ Gen<double[,]>.DelegateTest();
+ Gen<string[][][]>.DelegateTest();
+ Gen<object[,,,]>.DelegateTest();
+ Gen<Guid[][,,,][]>.DelegateTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread11.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread11.cs
new file mode 100644
index 0000000000..3001b72cc6
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread11.cs
@@ -0,0 +1,79 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target();
+ T Dummy(T t);
+}
+
+struct Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<T> obj = new Gen<T>();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest();
+ Gen<double>.DelegateTest();
+ Gen<string>.DelegateTest();
+ Gen<object>.DelegateTest();
+ Gen<Guid>.DelegateTest();
+
+ Gen<int[]>.DelegateTest();
+ Gen<double[,]>.DelegateTest();
+ Gen<string[][][]>.DelegateTest();
+ Gen<object[,,,]>.DelegateTest();
+ Gen<Guid[][,,,][]>.DelegateTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread12.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread12.cs
new file mode 100644
index 0000000000..8adcb5e9b8
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread12.cs
@@ -0,0 +1,79 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target();
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public virtual void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<T> obj = new Gen<T>();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest();
+ Gen<double>.DelegateTest();
+ Gen<string>.DelegateTest();
+ Gen<object>.DelegateTest();
+ Gen<Guid>.DelegateTest();
+
+ Gen<int[]>.DelegateTest();
+ Gen<double[,]>.DelegateTest();
+ Gen<string[][][]>.DelegateTest();
+ Gen<object[,,,]>.DelegateTest();
+ Gen<Guid[][,,,][]>.DelegateTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread13.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread13.cs
new file mode 100644
index 0000000000..96d26ebb1c
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread13.cs
@@ -0,0 +1,156 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target();
+ T Dummy(T t);
+}
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<int> obj = new GenInt();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<double> obj = new GenDouble();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<string> obj = new GenString();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<object> obj = new GenObject();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<Guid> obj = new GenGuid();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.DelegateTest();
+ GenDouble.DelegateTest();
+ GenString.DelegateTest();
+ GenObject.DelegateTest();
+ GenGuid.DelegateTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread14.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread14.cs
new file mode 100644
index 0000000000..b8b4d73e8b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread14.cs
@@ -0,0 +1,156 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target();
+ T Dummy(T t);
+}
+
+struct GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<int> obj = new GenInt();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<double> obj = new GenDouble();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<string> obj = new GenString();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<object> obj = new GenObject();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<Guid> obj = new GenGuid();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.DelegateTest();
+ GenDouble.DelegateTest();
+ GenString.DelegateTest();
+ GenObject.DelegateTest();
+ GenGuid.DelegateTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread15.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread15.cs
new file mode 100644
index 0000000000..f5fa909833
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread15.cs
@@ -0,0 +1,156 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target();
+ T Dummy(T t);
+}
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public virtual void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<int> obj = new GenInt();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public virtual void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<double> obj = new GenDouble();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public virtual void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<string> obj = new GenString();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public virtual void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<object> obj = new GenObject();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public virtual void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest()
+ {
+ IGen<Guid> obj = new GenGuid();
+ ThreadStart d = new ThreadStart(obj.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.DelegateTest();
+ GenDouble.DelegateTest();
+ GenString.DelegateTest();
+ GenObject.DelegateTest();
+ GenGuid.DelegateTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread16.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread16.cs
new file mode 100644
index 0000000000..0a74641bcf
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread16.cs
@@ -0,0 +1,70 @@
+// 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.Threading;
+
+interface IGen
+{
+ void Target<U>();
+}
+
+class Gen : IGen
+{
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ IGen obj = new Gen();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.DelegateTest<object>();
+ Gen.DelegateTest<string>();
+ Gen.DelegateTest<Guid>();
+ Gen.DelegateTest<int>();
+ Gen.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread17.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread17.cs
new file mode 100644
index 0000000000..5f9c1c0943
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread17.cs
@@ -0,0 +1,70 @@
+// 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.Threading;
+
+interface IGen
+{
+ void Target<U>();
+}
+
+struct Gen : IGen
+{
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ IGen obj = new Gen();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.DelegateTest<object>();
+ Gen.DelegateTest<string>();
+ Gen.DelegateTest<Guid>();
+ Gen.DelegateTest<int>();
+ Gen.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread18.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread18.cs
new file mode 100644
index 0000000000..10650c06cb
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread18.cs
@@ -0,0 +1,70 @@
+// 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.Threading;
+
+interface IGen
+{
+ void Target<U>();
+}
+
+class Gen : IGen
+{
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ IGen obj = new Gen();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.DelegateTest<object>();
+ Gen.DelegateTest<string>();
+ Gen.DelegateTest<Guid>();
+ Gen.DelegateTest<int>();
+ Gen.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread19.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread19.cs
new file mode 100644
index 0000000000..616886504e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread19.cs
@@ -0,0 +1,74 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target<U>();
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) {return t;}
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ IGen<T> obj = new Gen<T>();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest<object>();
+ Gen<double>.DelegateTest<string>();
+ Gen<string>.DelegateTest<Guid>();
+ Gen<object>.DelegateTest<int>();
+ Gen<Guid>.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread20.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread20.cs
new file mode 100644
index 0000000000..5b73e877b8
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread20.cs
@@ -0,0 +1,74 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target<U>();
+ T Dummy(T t);
+}
+
+struct Gen<T> : IGen<T>
+{
+ public T Dummy(T t) {return t;}
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ IGen<T> obj = new Gen<T>();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest<object>();
+ Gen<double>.DelegateTest<string>();
+ Gen<string>.DelegateTest<Guid>();
+ Gen<object>.DelegateTest<int>();
+ Gen<Guid>.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread21.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread21.cs
new file mode 100644
index 0000000000..07413138c3
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread21.cs
@@ -0,0 +1,74 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target<U>();
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) {return t;}
+
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ IGen<T> obj = new Gen<T>();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest<object>();
+ Gen<double>.DelegateTest<string>();
+ Gen<string>.DelegateTest<Guid>();
+ Gen<object>.DelegateTest<int>();
+ Gen<Guid>.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread22.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread22.cs
new file mode 100644
index 0000000000..59683e79eb
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread22.cs
@@ -0,0 +1,193 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target<U>();
+ T Dummy(T t);
+}
+
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<int> obj = new GenInt();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<double> obj = new GenDouble();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<string> obj = new GenString();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<object> obj = new GenObject();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<Guid> obj = new GenGuid();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.DelegateTest<int>();
+ GenDouble.DelegateTest<int>();
+ GenString.DelegateTest<int>();
+ GenObject.DelegateTest<int>();
+ GenGuid.DelegateTest<int>();
+
+ GenInt.DelegateTest<double>();
+ GenDouble.DelegateTest<double>();
+ GenString.DelegateTest<double>();
+ GenObject.DelegateTest<double>();
+ GenGuid.DelegateTest<double>();
+
+ GenInt.DelegateTest<string>();
+ GenDouble.DelegateTest<string>();
+ GenString.DelegateTest<string>();
+ GenObject.DelegateTest<string>();
+ GenGuid.DelegateTest<string>();
+
+ GenInt.DelegateTest<object>();
+ GenDouble.DelegateTest<object>();
+ GenString.DelegateTest<object>();
+ GenObject.DelegateTest<object>();
+ GenGuid.DelegateTest<object>();
+
+ GenInt.DelegateTest<Guid>();
+ GenDouble.DelegateTest<Guid>();
+ GenString.DelegateTest<Guid>();
+ GenObject.DelegateTest<Guid>();
+ GenGuid.DelegateTest<Guid>();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread23.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread23.cs
new file mode 100644
index 0000000000..93f639f187
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread23.cs
@@ -0,0 +1,193 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target<U>();
+ T Dummy(T t);
+}
+
+
+struct GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<int> obj = new GenInt();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<double> obj = new GenDouble();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<string> obj = new GenString();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<object> obj = new GenObject();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<Guid> obj = new GenGuid();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.DelegateTest<int>();
+ GenDouble.DelegateTest<int>();
+ GenString.DelegateTest<int>();
+ GenObject.DelegateTest<int>();
+ GenGuid.DelegateTest<int>();
+
+ GenInt.DelegateTest<double>();
+ GenDouble.DelegateTest<double>();
+ GenString.DelegateTest<double>();
+ GenObject.DelegateTest<double>();
+ GenGuid.DelegateTest<double>();
+
+ GenInt.DelegateTest<string>();
+ GenDouble.DelegateTest<string>();
+ GenString.DelegateTest<string>();
+ GenObject.DelegateTest<string>();
+ GenGuid.DelegateTest<string>();
+
+ GenInt.DelegateTest<object>();
+ GenDouble.DelegateTest<object>();
+ GenString.DelegateTest<object>();
+ GenObject.DelegateTest<object>();
+ GenGuid.DelegateTest<object>();
+
+ GenInt.DelegateTest<Guid>();
+ GenDouble.DelegateTest<Guid>();
+ GenString.DelegateTest<Guid>();
+ GenObject.DelegateTest<Guid>();
+ GenGuid.DelegateTest<Guid>();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread24.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread24.cs
new file mode 100644
index 0000000000..24d0ccc525
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread24.cs
@@ -0,0 +1,193 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target<U>();
+ T Dummy(T t);
+}
+
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<int> obj = new GenInt();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<double> obj = new GenDouble();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<string> obj = new GenString();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<object> obj = new GenObject();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void DelegateTest<U>()
+ {
+ IGen<Guid> obj = new GenGuid();
+ ThreadStart d = new ThreadStart(obj.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.DelegateTest<int>();
+ GenDouble.DelegateTest<int>();
+ GenString.DelegateTest<int>();
+ GenObject.DelegateTest<int>();
+ GenGuid.DelegateTest<int>();
+
+ GenInt.DelegateTest<double>();
+ GenDouble.DelegateTest<double>();
+ GenString.DelegateTest<double>();
+ GenObject.DelegateTest<double>();
+ GenGuid.DelegateTest<double>();
+
+ GenInt.DelegateTest<string>();
+ GenDouble.DelegateTest<string>();
+ GenString.DelegateTest<string>();
+ GenObject.DelegateTest<string>();
+ GenGuid.DelegateTest<string>();
+
+ GenInt.DelegateTest<object>();
+ GenDouble.DelegateTest<object>();
+ GenString.DelegateTest<object>();
+ GenObject.DelegateTest<object>();
+ GenGuid.DelegateTest<object>();
+
+ GenInt.DelegateTest<Guid>();
+ GenDouble.DelegateTest<Guid>();
+ GenString.DelegateTest<Guid>();
+ GenObject.DelegateTest<Guid>();
+ GenGuid.DelegateTest<Guid>();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread25.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread25.cs
new file mode 100644
index 0000000000..d98a49b1de
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread25.cs
@@ -0,0 +1,68 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public static void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest()
+ {
+ ThreadStart d = new ThreadStart(Gen<T>.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest();
+ Gen<double>.DelegateTest();
+ Gen<string>.DelegateTest();
+ Gen<object>.DelegateTest();
+ Gen<Guid>.DelegateTest();
+
+ Gen<int[]>.DelegateTest();
+ Gen<double[,]>.DelegateTest();
+ Gen<string[][][]>.DelegateTest();
+ Gen<object[,,,]>.DelegateTest();
+ Gen<Guid[][,,,][]>.DelegateTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread26.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread26.cs
new file mode 100644
index 0000000000..d131be9fba
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread26.cs
@@ -0,0 +1,68 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public static void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest()
+ {
+ ThreadStart d = new ThreadStart(Gen<T>.Target);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest();
+ Gen<double>.DelegateTest();
+ Gen<string>.DelegateTest();
+ Gen<object>.DelegateTest();
+ Gen<Guid>.DelegateTest();
+
+ Gen<int[]>.DelegateTest();
+ Gen<double[,]>.DelegateTest();
+ Gen<string[][][]>.DelegateTest();
+ Gen<object[,,,]>.DelegateTest();
+ Gen<Guid[][,,,][]>.DelegateTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread27.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread27.cs
new file mode 100644
index 0000000000..a56c396778
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread27.cs
@@ -0,0 +1,65 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public static void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ ThreadStart d = new ThreadStart(Gen<T>.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest<object>();
+ Gen<double>.DelegateTest<string>();
+ Gen<string>.DelegateTest<Guid>();
+ Gen<object>.DelegateTest<int>();
+ Gen<Guid>.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread28.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread28.cs
new file mode 100644
index 0000000000..4f1e755a29
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread28.cs
@@ -0,0 +1,65 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public static void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ ThreadStart d = new ThreadStart(Gen<T>.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.DelegateTest<object>();
+ Gen<double>.DelegateTest<string>();
+ Gen<string>.DelegateTest<Guid>();
+ Gen<object>.DelegateTest<int>();
+ Gen<Guid>.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread29.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread29.cs
new file mode 100644
index 0000000000..c1550050c6
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread29.cs
@@ -0,0 +1,64 @@
+// 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.Threading;
+
+class Gen
+{
+ public static void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ ThreadStart d = new ThreadStart(Gen.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.DelegateTest<object>();
+ Gen.DelegateTest<string>();
+ Gen.DelegateTest<Guid>();
+ Gen.DelegateTest<int>();
+ Gen.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/syncdelegate/thread30.cs b/tests/src/baseservices/threading/generics/syncdelegate/thread30.cs
new file mode 100644
index 0000000000..b180097170
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/syncdelegate/thread30.cs
@@ -0,0 +1,64 @@
+// 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.Threading;
+
+struct Gen
+{
+ public static void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void DelegateTest<U>()
+ {
+ ThreadStart d = new ThreadStart(Gen.Target<U>);
+
+
+ d();
+ Test.Eval(Test.Xcounter==1);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.DelegateTest<object>();
+ Gen.DelegateTest<string>();
+ Gen.DelegateTest<Guid>();
+ Gen.DelegateTest<int>();
+ Gen.DelegateTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread01.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread01.csproj
new file mode 100644
index 0000000000..c698a228fc
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread01.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread02.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread02.csproj
new file mode 100644
index 0000000000..d85759edda
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread02.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread03.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread03.csproj
new file mode 100644
index 0000000000..4b7e397537
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread03.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread04.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread04.csproj
new file mode 100644
index 0000000000..d57dadc72f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread04.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread04.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread05.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread05.csproj
new file mode 100644
index 0000000000..31d8753c1c
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread05.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread05.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread06.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread06.csproj
new file mode 100644
index 0000000000..3cd6365782
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread06.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread06.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread07.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread07.csproj
new file mode 100644
index 0000000000..cbef961f0a
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread07.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread07.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread08.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread08.csproj
new file mode 100644
index 0000000000..dc56ae4f5c
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread08.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread08.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread09.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread09.csproj
new file mode 100644
index 0000000000..509746e2c5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread09.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread09.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread10.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread10.csproj
new file mode 100644
index 0000000000..cacd4c4367
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread10.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread10.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread11.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread11.csproj
new file mode 100644
index 0000000000..0ecce49865
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread11.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread11.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread12.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread12.csproj
new file mode 100644
index 0000000000..7a4973aa71
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread12.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread12.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread13.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread13.csproj
new file mode 100644
index 0000000000..a97a685367
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread13.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread13.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread14.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread14.csproj
new file mode 100644
index 0000000000..18e5d7445c
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread14.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread14.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread15.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread15.csproj
new file mode 100644
index 0000000000..584cae692e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread15.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread15.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread16.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread16.csproj
new file mode 100644
index 0000000000..d845ee3385
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread16.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread16.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread17.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread17.csproj
new file mode 100644
index 0000000000..d20243abaa
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread17.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread17.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread18.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread18.csproj
new file mode 100644
index 0000000000..6cdb760ef9
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread18.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread18.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread19.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread19.csproj
new file mode 100644
index 0000000000..cc22171d44
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread19.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread19.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread20.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread20.csproj
new file mode 100644
index 0000000000..4e11b3384f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread20.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread20.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread21.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread21.csproj
new file mode 100644
index 0000000000..3763936378
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread21.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread21.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread22.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread22.csproj
new file mode 100644
index 0000000000..38aa2c006b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread22.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread22.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread23.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread23.csproj
new file mode 100644
index 0000000000..168d26be22
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread23.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread23.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread24.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread24.csproj
new file mode 100644
index 0000000000..97a83d5f35
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread24.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread24.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread25.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread25.csproj
new file mode 100644
index 0000000000..d7d9165a12
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread25.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread25.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread26.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread26.csproj
new file mode 100644
index 0000000000..e099a14795
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread26.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread26.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread27.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread27.csproj
new file mode 100644
index 0000000000..294e901611
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread27.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread27.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread28.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread28.csproj
new file mode 100644
index 0000000000..69b40e9924
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread28.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread28.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread29.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread29.csproj
new file mode 100644
index 0000000000..180dfcead0
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread29.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread29.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/GThread30.csproj b/tests/src/baseservices/threading/generics/threadstart/GThread30.csproj
new file mode 100644
index 0000000000..58e4b71fbd
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/GThread30.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="thread30.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread01.cs b/tests/src/baseservices/threading/generics/threadstart/thread01.cs
new file mode 100644
index 0000000000..4ab65e0133
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread01.cs
@@ -0,0 +1,78 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ Gen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread02.cs b/tests/src/baseservices/threading/generics/threadstart/thread02.cs
new file mode 100644
index 0000000000..45669ab6f6
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread02.cs
@@ -0,0 +1,78 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public virtual void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ Gen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread03.cs b/tests/src/baseservices/threading/generics/threadstart/thread03.cs
new file mode 100644
index 0000000000..725dd669b8
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread03.cs
@@ -0,0 +1,74 @@
+// 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.Threading;
+
+class Gen
+{
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ Gen obj = new Gen();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread04.cs b/tests/src/baseservices/threading/generics/threadstart/thread04.cs
new file mode 100644
index 0000000000..4f8622b5a5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread04.cs
@@ -0,0 +1,74 @@
+// 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.Threading;
+
+class Gen
+{
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ Gen obj = new Gen();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread05.cs b/tests/src/baseservices/threading/generics/threadstart/thread05.cs
new file mode 100644
index 0000000000..97497d6d39
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread05.cs
@@ -0,0 +1,74 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ Gen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread06.cs b/tests/src/baseservices/threading/generics/threadstart/thread06.cs
new file mode 100644
index 0000000000..db704d1cc3
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread06.cs
@@ -0,0 +1,74 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ Gen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread07.cs b/tests/src/baseservices/threading/generics/threadstart/thread07.cs
new file mode 100644
index 0000000000..13ae54cce7
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread07.cs
@@ -0,0 +1,78 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ Gen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread08.cs b/tests/src/baseservices/threading/generics/threadstart/thread08.cs
new file mode 100644
index 0000000000..cb75a1912f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread08.cs
@@ -0,0 +1,74 @@
+// 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.Threading;
+
+struct Gen
+{
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ Gen obj = new Gen();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread09.cs b/tests/src/baseservices/threading/generics/threadstart/thread09.cs
new file mode 100644
index 0000000000..be4ac8296a
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread09.cs
@@ -0,0 +1,74 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ Gen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread10.cs b/tests/src/baseservices/threading/generics/threadstart/thread10.cs
new file mode 100644
index 0000000000..1798e326de
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread10.cs
@@ -0,0 +1,88 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target();
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread11.cs b/tests/src/baseservices/threading/generics/threadstart/thread11.cs
new file mode 100644
index 0000000000..1e5d7b5bbb
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread11.cs
@@ -0,0 +1,88 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target();
+ T Dummy(T t);
+}
+
+struct Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread12.cs b/tests/src/baseservices/threading/generics/threadstart/thread12.cs
new file mode 100644
index 0000000000..4b216991f3
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread12.cs
@@ -0,0 +1,88 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target();
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) { return t; }
+
+ public virtual void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread13.cs b/tests/src/baseservices/threading/generics/threadstart/thread13.cs
new file mode 100644
index 0000000000..8d58f15197
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread13.cs
@@ -0,0 +1,201 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target();
+ T Dummy(T t);
+}
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<int> obj = new GenInt();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<double> obj = new GenDouble();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<string> obj = new GenString();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<object> obj = new GenObject();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<Guid> obj = new GenGuid();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest();
+ GenDouble.ThreadPoolTest();
+ GenString.ThreadPoolTest();
+ GenObject.ThreadPoolTest();
+ GenGuid.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread14.cs b/tests/src/baseservices/threading/generics/threadstart/thread14.cs
new file mode 100644
index 0000000000..7369b2dbde
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread14.cs
@@ -0,0 +1,201 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target();
+ T Dummy(T t);
+}
+
+struct GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<int> obj = new GenInt();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<double> obj = new GenDouble();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<string> obj = new GenString();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<object> obj = new GenObject();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<Guid> obj = new GenGuid();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest();
+ GenDouble.ThreadPoolTest();
+ GenString.ThreadPoolTest();
+ GenObject.ThreadPoolTest();
+ GenGuid.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread15.cs b/tests/src/baseservices/threading/generics/threadstart/thread15.cs
new file mode 100644
index 0000000000..5ae8a67de3
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread15.cs
@@ -0,0 +1,201 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target();
+ T Dummy(T t);
+}
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public virtual void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<int> obj = new GenInt();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public virtual void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<double> obj = new GenDouble();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public virtual void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<string> obj = new GenString();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public virtual void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<object> obj = new GenObject();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public virtual void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<Guid> obj = new GenGuid();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result &= exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest();
+ GenDouble.ThreadPoolTest();
+ GenString.ThreadPoolTest();
+ GenObject.ThreadPoolTest();
+ GenGuid.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread16.cs b/tests/src/baseservices/threading/generics/threadstart/thread16.cs
new file mode 100644
index 0000000000..c798fe727e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread16.cs
@@ -0,0 +1,79 @@
+// 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.Threading;
+
+interface IGen
+{
+ void Target<U>();
+}
+
+class Gen : IGen
+{
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen obj = new Gen();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread17.cs b/tests/src/baseservices/threading/generics/threadstart/thread17.cs
new file mode 100644
index 0000000000..b9852de9e8
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread17.cs
@@ -0,0 +1,79 @@
+// 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.Threading;
+
+interface IGen
+{
+ void Target<U>();
+}
+
+struct Gen : IGen
+{
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen obj = new Gen();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread18.cs b/tests/src/baseservices/threading/generics/threadstart/thread18.cs
new file mode 100644
index 0000000000..7eabb433a4
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread18.cs
@@ -0,0 +1,79 @@
+// 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.Threading;
+
+interface IGen
+{
+ void Target<U>();
+}
+
+class Gen : IGen
+{
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen obj = new Gen();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread19.cs b/tests/src/baseservices/threading/generics/threadstart/thread19.cs
new file mode 100644
index 0000000000..e302bf0e57
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread19.cs
@@ -0,0 +1,83 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target<U>();
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) {return t;}
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread20.cs b/tests/src/baseservices/threading/generics/threadstart/thread20.cs
new file mode 100644
index 0000000000..d862f32581
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread20.cs
@@ -0,0 +1,83 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target<U>();
+ T Dummy(T t);
+}
+
+struct Gen<T> : IGen<T>
+{
+ public T Dummy(T t) {return t;}
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread21.cs b/tests/src/baseservices/threading/generics/threadstart/thread21.cs
new file mode 100644
index 0000000000..b75a7d399a
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread21.cs
@@ -0,0 +1,83 @@
+// 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.Threading;
+
+
+interface IGen<T>
+{
+ void Target<U>();
+ T Dummy(T t);
+}
+
+class Gen<T> : IGen<T>
+{
+ public T Dummy(T t) {return t;}
+
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<T> obj = new Gen<T>();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread22.cs b/tests/src/baseservices/threading/generics/threadstart/thread22.cs
new file mode 100644
index 0000000000..4ca3606b67
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread22.cs
@@ -0,0 +1,238 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target<U>();
+ T Dummy(T t);
+}
+
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<int> obj = new GenInt();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<double> obj = new GenDouble();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<string> obj = new GenString();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<object> obj = new GenObject();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<Guid> obj = new GenGuid();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest<int>();
+ GenDouble.ThreadPoolTest<int>();
+ GenString.ThreadPoolTest<int>();
+ GenObject.ThreadPoolTest<int>();
+ GenGuid.ThreadPoolTest<int>();
+
+ GenInt.ThreadPoolTest<double>();
+ GenDouble.ThreadPoolTest<double>();
+ GenString.ThreadPoolTest<double>();
+ GenObject.ThreadPoolTest<double>();
+ GenGuid.ThreadPoolTest<double>();
+
+ GenInt.ThreadPoolTest<string>();
+ GenDouble.ThreadPoolTest<string>();
+ GenString.ThreadPoolTest<string>();
+ GenObject.ThreadPoolTest<string>();
+ GenGuid.ThreadPoolTest<string>();
+
+ GenInt.ThreadPoolTest<object>();
+ GenDouble.ThreadPoolTest<object>();
+ GenString.ThreadPoolTest<object>();
+ GenObject.ThreadPoolTest<object>();
+ GenGuid.ThreadPoolTest<object>();
+
+ GenInt.ThreadPoolTest<Guid>();
+ GenDouble.ThreadPoolTest<Guid>();
+ GenString.ThreadPoolTest<Guid>();
+ GenObject.ThreadPoolTest<Guid>();
+ GenGuid.ThreadPoolTest<Guid>();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread23.cs b/tests/src/baseservices/threading/generics/threadstart/thread23.cs
new file mode 100644
index 0000000000..d776b4b004
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread23.cs
@@ -0,0 +1,238 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target<U>();
+ T Dummy(T t);
+}
+
+
+struct GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<int> obj = new GenInt();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<double> obj = new GenDouble();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<string> obj = new GenString();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<object> obj = new GenObject();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+struct GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<Guid> obj = new GenGuid();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest<int>();
+ GenDouble.ThreadPoolTest<int>();
+ GenString.ThreadPoolTest<int>();
+ GenObject.ThreadPoolTest<int>();
+ GenGuid.ThreadPoolTest<int>();
+
+ GenInt.ThreadPoolTest<double>();
+ GenDouble.ThreadPoolTest<double>();
+ GenString.ThreadPoolTest<double>();
+ GenObject.ThreadPoolTest<double>();
+ GenGuid.ThreadPoolTest<double>();
+
+ GenInt.ThreadPoolTest<string>();
+ GenDouble.ThreadPoolTest<string>();
+ GenString.ThreadPoolTest<string>();
+ GenObject.ThreadPoolTest<string>();
+ GenGuid.ThreadPoolTest<string>();
+
+ GenInt.ThreadPoolTest<object>();
+ GenDouble.ThreadPoolTest<object>();
+ GenString.ThreadPoolTest<object>();
+ GenObject.ThreadPoolTest<object>();
+ GenGuid.ThreadPoolTest<object>();
+
+ GenInt.ThreadPoolTest<Guid>();
+ GenDouble.ThreadPoolTest<Guid>();
+ GenString.ThreadPoolTest<Guid>();
+ GenObject.ThreadPoolTest<Guid>();
+ GenGuid.ThreadPoolTest<Guid>();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread24.cs b/tests/src/baseservices/threading/generics/threadstart/thread24.cs
new file mode 100644
index 0000000000..86c6bd98cc
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread24.cs
@@ -0,0 +1,238 @@
+// 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.Threading;
+
+interface IGen<T>
+{
+ void Target<U>();
+ T Dummy(T t);
+}
+
+
+class GenInt : IGen<int>
+{
+ public int Dummy(int t) { return t; }
+
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<int> obj = new GenInt();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenDouble : IGen<double>
+{
+ public double Dummy(double t) { return t; }
+
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<double> obj = new GenDouble();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenString : IGen<string>
+{
+ public string Dummy(string t) { return t; }
+
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<string> obj = new GenString();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenObject : IGen<object>
+{
+ public object Dummy(object t) { return t; }
+
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<object> obj = new GenObject();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+class GenGuid : IGen<Guid>
+{
+ public Guid Dummy(Guid t) { return t; }
+
+ public virtual void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+ IGen<Guid> obj = new GenGuid();
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(obj.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ GenInt.ThreadPoolTest<int>();
+ GenDouble.ThreadPoolTest<int>();
+ GenString.ThreadPoolTest<int>();
+ GenObject.ThreadPoolTest<int>();
+ GenGuid.ThreadPoolTest<int>();
+
+ GenInt.ThreadPoolTest<double>();
+ GenDouble.ThreadPoolTest<double>();
+ GenString.ThreadPoolTest<double>();
+ GenObject.ThreadPoolTest<double>();
+ GenGuid.ThreadPoolTest<double>();
+
+ GenInt.ThreadPoolTest<string>();
+ GenDouble.ThreadPoolTest<string>();
+ GenString.ThreadPoolTest<string>();
+ GenObject.ThreadPoolTest<string>();
+ GenGuid.ThreadPoolTest<string>();
+
+ GenInt.ThreadPoolTest<object>();
+ GenDouble.ThreadPoolTest<object>();
+ GenString.ThreadPoolTest<object>();
+ GenObject.ThreadPoolTest<object>();
+ GenGuid.ThreadPoolTest<object>();
+
+ GenInt.ThreadPoolTest<Guid>();
+ GenDouble.ThreadPoolTest<Guid>();
+ GenString.ThreadPoolTest<Guid>();
+ GenObject.ThreadPoolTest<Guid>();
+ GenGuid.ThreadPoolTest<Guid>();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread25.cs b/tests/src/baseservices/threading/generics/threadstart/thread25.cs
new file mode 100644
index 0000000000..b14e5df356
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread25.cs
@@ -0,0 +1,77 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public static void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(Gen<T>.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread26.cs b/tests/src/baseservices/threading/generics/threadstart/thread26.cs
new file mode 100644
index 0000000000..c3036a90b5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread26.cs
@@ -0,0 +1,77 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public static void Target()
+ {
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(Gen<T>.Target));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads = 50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest();
+ Gen<double>.ThreadPoolTest();
+ Gen<string>.ThreadPoolTest();
+ Gen<object>.ThreadPoolTest();
+ Gen<Guid>.ThreadPoolTest();
+
+ Gen<int[]>.ThreadPoolTest();
+ Gen<double[,]>.ThreadPoolTest();
+ Gen<string[][][]>.ThreadPoolTest();
+ Gen<object[,,,]>.ThreadPoolTest();
+ Gen<Guid[][,,,][]>.ThreadPoolTest();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread27.cs b/tests/src/baseservices/threading/generics/threadstart/thread27.cs
new file mode 100644
index 0000000000..db223c445a
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread27.cs
@@ -0,0 +1,74 @@
+// 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.Threading;
+
+class Gen<T>
+{
+ public static void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(Gen<T>.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread28.cs b/tests/src/baseservices/threading/generics/threadstart/thread28.cs
new file mode 100644
index 0000000000..5d3959ea71
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread28.cs
@@ -0,0 +1,74 @@
+// 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.Threading;
+
+struct Gen<T>
+{
+ public static void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(Gen<T>.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen<int>.ThreadPoolTest<object>();
+ Gen<double>.ThreadPoolTest<string>();
+ Gen<string>.ThreadPoolTest<Guid>();
+ Gen<object>.ThreadPoolTest<int>();
+ Gen<Guid>.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread29.cs b/tests/src/baseservices/threading/generics/threadstart/thread29.cs
new file mode 100644
index 0000000000..07e2c557d3
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread29.cs
@@ -0,0 +1,73 @@
+// 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.Threading;
+
+class Gen
+{
+ public static void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(Gen.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/generics/threadstart/thread30.cs b/tests/src/baseservices/threading/generics/threadstart/thread30.cs
new file mode 100644
index 0000000000..eba2dbfed9
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/threadstart/thread30.cs
@@ -0,0 +1,73 @@
+// 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.Threading;
+
+struct Gen
+{
+ public static void Target<U>()
+ {
+ //dummy line to avoid warnings
+ Test.Eval(typeof(U)!=null);
+ Interlocked.Increment(ref Test.Xcounter);
+ }
+ public static void ThreadPoolTest<U>()
+ {
+ Thread[] threads = new Thread[Test.nThreads];
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(Gen.Target<U>));
+ threads[i].Start();
+ }
+
+ for (int i = 0; i < Test.nThreads; i++)
+ {
+ threads[i].Join();
+ }
+
+ Test.Eval(Test.Xcounter==Test.nThreads);
+ Test.Xcounter = 0;
+ }
+}
+
+public class Test
+{
+ public static int nThreads =50;
+ public static int counter = 0;
+ public static int Xcounter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ Gen.ThreadPoolTest<object>();
+ Gen.ThreadPoolTest<string>();
+ Gen.ThreadPoolTest<Guid>();
+ Gen.ThreadPoolTest<int>();
+ Gen.ThreadPoolTest<double>();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
diff --git a/tests/src/baseservices/threading/interlocked/add/CheckAddInt.csproj b/tests/src/baseservices/threading/interlocked/add/CheckAddInt.csproj
new file mode 100644
index 0000000000..28eba60da4
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/CheckAddInt.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>/start:2147483647 /add:100</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="checkaddint.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/interlocked/add/CheckAddInt_1.csproj b/tests/src/baseservices/threading/interlocked/add/CheckAddInt_1.csproj
new file mode 100644
index 0000000000..9c7c16f3bd
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/CheckAddInt_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>CheckAddInt.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>/start:0 /add:100</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/CheckAddLong.csproj b/tests/src/baseservices/threading/interlocked/add/CheckAddLong.csproj
new file mode 100644
index 0000000000..5759443ea4
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/CheckAddLong.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>/start:922337203685477 /add:100</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="checkaddlong.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/interlocked/add/CheckAddLong_1.csproj b/tests/src/baseservices/threading/interlocked/add/CheckAddLong_1.csproj
new file mode 100644
index 0000000000..d76d4d5fe0
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/CheckAddLong_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>CheckAddLong.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>/start:-922337203685477 /add:100</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/InterlockedAddInt.csproj b/tests/src/baseservices/threading/interlocked/add/InterlockedAddInt.csproj
new file mode 100644
index 0000000000..f220c42abe
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/InterlockedAddInt.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>/loops:100 /addVal:-214748</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="interlockedaddint.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/interlocked/add/InterlockedAddInt_1.csproj b/tests/src/baseservices/threading/interlocked/add/InterlockedAddInt_1.csproj
new file mode 100644
index 0000000000..695fe67e31
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/InterlockedAddInt_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>InterlockedAddInt.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>/loops:100 /addVal:0</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/InterlockedAddInt_2.csproj b/tests/src/baseservices/threading/interlocked/add/InterlockedAddInt_2.csproj
new file mode 100644
index 0000000000..95b231eaf7
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/InterlockedAddInt_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>InterlockedAddInt.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>/loops:100 /addVal:100</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/InterlockedAddInt_3.csproj b/tests/src/baseservices/threading/interlocked/add/InterlockedAddInt_3.csproj
new file mode 100644
index 0000000000..59636a5ea3
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/InterlockedAddInt_3.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>InterlockedAddInt.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>/loops:100 /addVal:214748</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/InterlockedAddLong.csproj b/tests/src/baseservices/threading/interlocked/add/InterlockedAddLong.csproj
new file mode 100644
index 0000000000..8420ded594
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/InterlockedAddLong.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>/loops:100 /addVal:100</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="interlockedaddlong.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/interlocked/add/InterlockedAddLongWithSubtract.csproj b/tests/src/baseservices/threading/interlocked/add/InterlockedAddLongWithSubtract.csproj
new file mode 100644
index 0000000000..3248fb5102
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/InterlockedAddLongWithSubtract.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/loops:500000 /addVal:1</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="interlockedaddlongwithsubtract.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/InterlockedAddLong_1.csproj b/tests/src/baseservices/threading/interlocked/add/InterlockedAddLong_1.csproj
new file mode 100644
index 0000000000..c65d0194a6
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/InterlockedAddLong_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>InterlockedAddLong.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>/loops:100 /addVal:922337203685477</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/InterlockedAddLong_2.csproj b/tests/src/baseservices/threading/interlocked/add/InterlockedAddLong_2.csproj
new file mode 100644
index 0000000000..28d6977606
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/InterlockedAddLong_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>InterlockedAddLong.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>/loops:100 /addVal:-922337203685477</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/add.cs b/tests/src/baseservices/threading/interlocked/add/add.cs
new file mode 100644
index 0000000000..52bbb1782d
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/add.cs
@@ -0,0 +1,41 @@
+// 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.Threading;
+
+public class Test
+{
+
+ public static int Main()
+ {
+ int retVal = 100;
+
+ int val = 20;
+ int adder= 5;
+ int foo = Interlocked.Add(ref val, adder);
+ Console.WriteLine("NewValue: " + val);
+ Console.WriteLine("OldValue: " + foo);
+ //if(foo != 20 && val != 25)
+ if ((val != 25) || (foo != val))
+ retVal = -1;
+
+ long val1 = 20;
+ long adder1= 5;
+ long foo1 = Interlocked.Add(ref val1, adder1);
+ Console.WriteLine("NewValue: " + val1);
+ Console.WriteLine("OldValue: " + foo1);
+ //if(foo1 != 20 && val1 != 25)
+ if ((val1 != 25) || (foo1 != val1))
+ retVal = -1;
+
+ if (retVal == 100)
+ Console.WriteLine("Test passed");
+ else
+ Console.WriteLine("Test failed");
+
+ return retVal;
+
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/add/add.csproj b/tests/src/baseservices/threading/interlocked/add/add.csproj
new file mode 100644
index 0000000000..efd2947a34
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/add.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="add.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/checkaddint.cs b/tests/src/baseservices/threading/interlocked/add/checkaddint.cs
new file mode 100644
index 0000000000..0e38604f28
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/checkaddint.cs
@@ -0,0 +1,64 @@
+// 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.Threading;
+
+class CheckAddInt
+{
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: CheckAddInt " +
+ "/start:<int> /add:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iStart=0;
+ int iAdd = 0;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/start:"))
+ {
+ iStart = Convert.ToInt32(args[i].Substring(7));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/add:"))
+ {
+ iAdd = Convert.ToInt32(args[i].Substring(5));
+ continue;
+ }
+ }
+
+ CheckAddInt cai = new CheckAddInt();
+ return cai.Run(iStart, iAdd);
+ }
+
+ private int Run(int iStart, int iAdd)
+ {
+ int iNew = 0;
+ int iNewExpected;
+ int iTotal = iStart;
+ for(int i=0;i<iAdd;i++)
+ {
+ iNewExpected = iTotal + (i * (i + 1));
+ iNew = Interlocked.Add(ref iTotal, (i * (i + 1)));
+
+ if ((iNew != iNewExpected) || (iNew != iTotal))
+ {
+ Console.WriteLine(iNew + " " + iNewExpected + " " + iTotal);
+ Console.WriteLine("Test Failed");
+ return -1;
+ }
+ Console.WriteLine(iNew);
+ }
+
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/checkaddlong.cs b/tests/src/baseservices/threading/interlocked/add/checkaddlong.cs
new file mode 100644
index 0000000000..5e161057cb
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/checkaddlong.cs
@@ -0,0 +1,64 @@
+// 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.Threading;
+
+class CheckAddInt
+{
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: CheckAddInt " +
+ "/start:<long> /add:<int>");
+ return -1;
+ }
+
+ // Get the args
+ long iStart=0;
+ int iAdd = 0;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/start:"))
+ {
+ iStart = Convert.ToInt64(args[i].Substring(7));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/add:"))
+ {
+ iAdd = Convert.ToInt32(args[i].Substring(5));
+ continue;
+ }
+ }
+
+ CheckAddInt cai = new CheckAddInt();
+ return cai.Run(iStart, iAdd);
+ }
+
+ private int Run(long iStart, int iAdd)
+ {
+ long iNew = 0;
+ long iNewExpected;
+ long iTotal = iStart;
+ for(int i=0;i<iAdd;i++)
+ {
+ iNewExpected = iTotal + (i * (i + 1));
+ iNew = Interlocked.Add(ref iTotal, (i * (i + 1)));
+
+ if((iNew != iNewExpected) || (iNew != iTotal))
+ {
+ Console.WriteLine(iNew + " " + iNewExpected + " " + iTotal);
+ Console.WriteLine("Test Failed");
+ return -1;
+ }
+ Console.WriteLine(iNew);
+ }
+
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/interlockedaddint.cs b/tests/src/baseservices/threading/interlocked/add/interlockedaddint.cs
new file mode 100644
index 0000000000..09b4cfd558
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/interlockedaddint.cs
@@ -0,0 +1,101 @@
+// 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.Threading;
+
+namespace ExchangeAdd
+{
+ class InterlockedAddInt
+ {
+ static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: InterlockedAddInt " +
+ "/loops:<int> /addVal:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int loops=100;
+ int valueToAdd = 0;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/loops:"))
+ {
+ loops = Convert.ToInt32(args[i].Substring(7));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/addval:"))
+ {
+ valueToAdd = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+ }
+
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe(loops, valueToAdd);
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorker));
+ threads[i].Start();
+ }
+
+ tsi.Signal();
+
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+
+ if (tsi.Total == tsi.Expected * threads.Length)
+ rValue = 100;
+ Console.WriteLine("Expected: " + (tsi.Expected * threads.Length));
+ Console.WriteLine("Actual: " + tsi.Total);
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ManualResetEvent signal;
+ private int totalValue = 0;
+ private int numberOfIterations;
+ private int valueToAdd;
+ public ThreadSafe(): this(100,100) { }
+ public ThreadSafe(int loops, int iAdd)
+ {
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ valueToAdd = iAdd;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorker()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ Interlocked.Add(ref totalValue, valueToAdd);
+
+ }
+ public int Expected
+ {
+ get
+ {
+ return (numberOfIterations * valueToAdd);
+ }
+ }
+ public int Total
+ {
+ get { return totalValue; }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/interlockedaddintwithsubtract.cs b/tests/src/baseservices/threading/interlocked/add/interlockedaddintwithsubtract.cs
new file mode 100644
index 0000000000..b103ec519e
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/interlockedaddintwithsubtract.cs
@@ -0,0 +1,107 @@
+// 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.Threading;
+//Regression for DevDiv Bugs 48020
+namespace ExchangeAdd
+{
+ class InterlockedAddInt
+ {
+ static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: InterlockedAddIntWithSubtract " +
+ "/loops:<int> /addVal:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int loops=100;
+ int valueToAdd = 0;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/loops:"))
+ {
+ loops = Convert.ToInt32(args[i].Substring(7));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/addval:"))
+ {
+ valueToAdd = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+ }
+
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe(loops, valueToAdd);
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorker));
+ threads[i].Start();
+ }
+
+ tsi.Signal();
+
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+
+ if (tsi.Total == tsi.Expected * threads.Length)
+ rValue = 100;
+ Console.WriteLine("Expected: " + (tsi.Expected * threads.Length));
+ Console.WriteLine("Actual: " + tsi.Total);
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ManualResetEvent signal;
+ private int totalValue = 0;
+ private int numberOfIterations;
+ private int valueToAdd;
+ private int valueToSubtract;
+ public ThreadSafe(): this(100,100) { }
+ public ThreadSafe(int loops, int iAdd)
+ {
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ valueToAdd = iAdd;
+ valueToSubtract = 0-iAdd;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorker()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ {
+ Interlocked.Add(ref totalValue, valueToAdd);
+ Interlocked.Add(ref totalValue, valueToSubtract);
+ }
+
+ }
+ public int Expected
+ {
+ get
+ {
+ return (0);
+ }
+ }
+ public int Total
+ {
+ get { return totalValue; }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/interlockedaddintwithsubtract.csproj b/tests/src/baseservices/threading/interlocked/add/interlockedaddintwithsubtract.csproj
new file mode 100644
index 0000000000..14bb097713
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/interlockedaddintwithsubtract.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/loops:500000 /addVal:1</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="InterlockedAddIntWithSubtract.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/interlockedaddlong.cs b/tests/src/baseservices/threading/interlocked/add/interlockedaddlong.cs
new file mode 100644
index 0000000000..c0e83707e2
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/interlockedaddlong.cs
@@ -0,0 +1,101 @@
+// 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.Threading;
+
+namespace ExchangeAdd
+{
+ class InterlockedAddLong
+ {
+ static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: InterlockedAddLong " +
+ "/loops:<int> /addVal:<long>");
+ return -1;
+ }
+
+ // Get the args
+ int loops=100;
+ long valueToAdd = 0;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/loops:"))
+ {
+ loops = Convert.ToInt32(args[i].Substring(7));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/addval:"))
+ {
+ valueToAdd = Convert.ToInt64(args[i].Substring(8));
+ continue;
+ }
+ }
+
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe(loops, valueToAdd);
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorker));
+ threads[i].Start();
+ }
+
+ tsi.Signal();
+
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+
+ if (tsi.Total == tsi.Expected * threads.Length)
+ rValue = 100;
+ Console.WriteLine("Expected: " + (tsi.Expected * threads.Length));
+ Console.WriteLine("Actual: " + tsi.Total);
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ManualResetEvent signal;
+ private long totalValue = 0;
+ private int numberOfIterations;
+ private long valueToAdd;
+ public ThreadSafe(): this(100,100) { }
+ public ThreadSafe(int loops, long lAdd)
+ {
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ valueToAdd = lAdd;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorker()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ Interlocked.Add(ref totalValue, valueToAdd);
+
+ }
+ public long Expected
+ {
+ get
+ {
+ return (numberOfIterations * valueToAdd);
+ }
+ }
+ public long Total
+ {
+ get { return totalValue; }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/add/interlockedaddlongwithsubtract.cs b/tests/src/baseservices/threading/interlocked/add/interlockedaddlongwithsubtract.cs
new file mode 100644
index 0000000000..bc641afdb1
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/add/interlockedaddlongwithsubtract.cs
@@ -0,0 +1,106 @@
+// 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.Threading;
+//Regression for DevDiv Bugs 48020
+namespace ExchangeAdd
+{
+ class InterlockedAddInt
+ {
+ static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: InterlockedAddLongWithSubtract " +
+ "/loops:<int> /addVal:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int loops=100;
+ long valueToAdd = 0;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/loops:"))
+ {
+ loops = Convert.ToInt32(args[i].Substring(7));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/addval:"))
+ {
+ valueToAdd = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+ }
+
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe(loops, valueToAdd);
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorker));
+ threads[i].Start();
+ }
+
+ tsi.Signal();
+
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+
+ if (tsi.Total == tsi.Expected * threads.Length)
+ rValue = 100;
+ Console.WriteLine("Expected: " + (tsi.Expected * threads.Length));
+ Console.WriteLine("Actual: " + tsi.Total);
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ManualResetEvent signal;
+ private long totalValue = 0;
+ private int numberOfIterations;
+ private long valueToAdd;
+ private long valueToSubtract;
+ public ThreadSafe(): this(100,100) { }
+ public ThreadSafe(int loops, long iAdd)
+ {
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ valueToAdd = iAdd;
+ valueToSubtract = 0-iAdd;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorker()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ {
+ Interlocked.Add(ref totalValue, valueToAdd);
+ Interlocked.Add(ref totalValue, valueToSubtract);
+ }
+
+ }
+ public long Expected
+ {
+ get
+ {
+ return (0);
+ }
+ }
+ public long Total
+ {
+ get { return totalValue; }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/checkreturn/intdeccheckreturn.cs b/tests/src/baseservices/threading/interlocked/checkreturn/intdeccheckreturn.cs
new file mode 100644
index 0000000000..8ef3cd94e5
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/checkreturn/intdeccheckreturn.cs
@@ -0,0 +1,23 @@
+// 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.Threading;
+
+namespace InterlockedTest
+{
+ class InterlockTest
+ {
+
+ public static int Main(string[] Args)
+ {
+ int rValue;
+ IntTest testInt = new IntTest(100, 10);
+
+ Console.WriteLine("Check Inc Returnt: {0}", rValue = testInt.CheckDecReturn());
+ Console.WriteLine("Test {0}", 100 == rValue ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/checkreturn/intdeccheckreturn.csproj b/tests/src/baseservices/threading/interlocked/checkreturn/intdeccheckreturn.csproj
new file mode 100644
index 0000000000..b0a14f5041
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/checkreturn/intdeccheckreturn.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="..\common\InterlockedHelper_CoreCLR.cs" />
+ <Compile Include="IntDecCheckReturn.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/checkreturn/intinccheckreturn.cs b/tests/src/baseservices/threading/interlocked/checkreturn/intinccheckreturn.cs
new file mode 100644
index 0000000000..6fd08999ea
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/checkreturn/intinccheckreturn.cs
@@ -0,0 +1,23 @@
+// 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.Threading;
+
+namespace InterlockedTest
+{
+ class InterlockTest
+ {
+
+ public static int Main(string[] Args)
+ {
+ int rValue;
+ IntTest testInt = new IntTest(100, 10);
+
+ Console.WriteLine("Check Inc Returnt: {0}", rValue = testInt.CheckIncReturn());
+ Console.WriteLine("Test {0}", 100 == rValue ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/checkreturn/intinccheckreturn.csproj b/tests/src/baseservices/threading/interlocked/checkreturn/intinccheckreturn.csproj
new file mode 100644
index 0000000000..a9918d3a69
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/checkreturn/intinccheckreturn.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="..\common\InterlockedHelper_CoreCLR.cs" />
+ <Compile Include="IntIncCheckReturn.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/checkreturn/longdeccheckreturn.cs b/tests/src/baseservices/threading/interlocked/checkreturn/longdeccheckreturn.cs
new file mode 100644
index 0000000000..8a39c6a87d
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/checkreturn/longdeccheckreturn.cs
@@ -0,0 +1,22 @@
+// 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.Threading;
+
+namespace InterlockedTest
+{
+ class InterlockTest
+ {
+ public static int Main(string[] Args)
+ {
+ int rValue;
+ LongTest testLong = new LongTest();
+
+ Console.WriteLine("Check Decrement: {0}", rValue = testLong.CheckDecReturn());
+ Console.WriteLine("Test {0}", 100 == rValue ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/checkreturn/longdeccheckreturn.csproj b/tests/src/baseservices/threading/interlocked/checkreturn/longdeccheckreturn.csproj
new file mode 100644
index 0000000000..3327f831b0
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/checkreturn/longdeccheckreturn.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="..\common\InterlockedHelper_CoreCLR.cs" />
+ <Compile Include="LongDecCheckReturn.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/checkreturn/longinccheckreturn.cs b/tests/src/baseservices/threading/interlocked/checkreturn/longinccheckreturn.cs
new file mode 100644
index 0000000000..1a5a59c15a
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/checkreturn/longinccheckreturn.cs
@@ -0,0 +1,22 @@
+// 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.Threading;
+
+namespace InterlockedTest
+{
+ class InterlockTest
+ {
+ public static int Main(string[] Args)
+ {
+ int rValue;
+ LongTest testLong = new LongTest();
+
+ Console.WriteLine("Check Decrement: {0}", rValue = testLong.CheckIncReturn());
+ Console.WriteLine("Test {0}", 100 == rValue ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/checkreturn/longinccheckreturn.csproj b/tests/src/baseservices/threading/interlocked/checkreturn/longinccheckreturn.csproj
new file mode 100644
index 0000000000..2453c4055f
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/checkreturn/longinccheckreturn.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="..\common\InterlockedHelper_CoreCLR.cs" />
+ <Compile Include="LongIncCheckReturn.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/common/interlockedhelper_coreclr.cs b/tests/src/baseservices/threading/interlocked/common/interlockedhelper_coreclr.cs
new file mode 100644
index 0000000000..f9d39a3812
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/common/interlockedhelper_coreclr.cs
@@ -0,0 +1,282 @@
+// 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.Threading;
+
+namespace InterlockedTest
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ ///
+ class LongTest
+ {
+ long sharedValue;
+ int iterations;
+ ManualResetEvent signal;
+ Thread[] threads;
+ public LongTest() { }
+ public LongTest(int LoopValue, int NumberOfThreads)
+ {
+ threads = new Thread[NumberOfThreads];
+ iterations = LoopValue;
+ signal = new ManualResetEvent(false);
+ }
+ public int Inc()
+ {
+ sharedValue = 0;
+ long expectedValue = iterations * threads.Length;
+
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(this.SimpleIncrement));
+ threads[i].Start();
+ }
+
+ Thread.Sleep(100);
+ signal.Set();
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+ if (sharedValue == expectedValue)
+ return 100;
+
+ return -1;
+ }
+ public int Dec()
+ {
+ sharedValue = iterations * threads.Length;
+
+ int expectedValue = 0;
+
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(this.SimpleDecrement));
+ threads[i].Start();
+ }
+
+ Thread.Sleep(100);
+ signal.Set();
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+
+ if (sharedValue == expectedValue)
+ return 100;
+
+ return -1;
+ }
+ private void SimpleIncrement()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < iterations; i++)
+ Interlocked.Increment(ref sharedValue);
+ }
+ private void SimpleDecrement()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < iterations; i++)
+ Interlocked.Decrement(ref sharedValue);
+ }
+ public int CheckIncReturn()
+ {
+ long sharedValue;
+ int rValue = 0;
+
+ foreach (long val in LongVals)
+ {
+ sharedValue = val;
+
+ Console.WriteLine("Test for Inc with value {0}", val);
+ Console.WriteLine("Expected : {0}", val + 1);
+ long returnV = Interlocked.Increment(ref sharedValue);
+ if (val + 1 != returnV )
+ {
+ Console.WriteLine("Failed: Return value is wrong: {0}", returnV);
+ rValue = -1;
+ }
+ if (val + 1 != sharedValue)
+ {
+ Console.WriteLine("Failed: refence value is wrong: {0}", sharedValue);
+ rValue = -2;
+ }
+ }
+
+ if (rValue == 0)
+ rValue = 100;
+
+ return rValue;
+ }
+ public int CheckDecReturn()
+ {
+ long sharedValue;
+ int rValue =0;
+ foreach (long val in LongVals)
+ {
+ sharedValue = val;
+
+ Console.WriteLine("Test for Dec with value {0}", val);
+ Console.WriteLine("Expected : {0}", val - 1);
+ long returnV = Interlocked.Decrement(ref sharedValue);
+ if (val - 1 != returnV)
+ {
+ Console.WriteLine("Failed: Return value is wrong: {0}", returnV);
+ rValue = -1;
+ }
+ if (val -1 != sharedValue)
+ {
+ Console.WriteLine("Failed: refence value is wrong: {0}", sharedValue);
+ rValue = -2;
+ }
+ }
+ if(rValue == 0)
+ rValue = 100;
+ return rValue;
+ }
+ long[] LongVals = new long[5]
+ {
+ Int64.MinValue,
+ Int64.MaxValue,
+ 0,
+ -1,
+ 1
+ };
+ }
+
+
+
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ ///
+ class IntTest
+ {
+ int sharedValue;
+ int iterations;
+ ManualResetEvent signal;
+ Thread[] threads;
+ public IntTest(int LoopValue, int NumberOfThreads)
+ {
+ threads = new Thread[NumberOfThreads];
+ iterations = LoopValue;
+ signal = new ManualResetEvent(false);
+ }
+ public int Inc()
+ {
+ sharedValue = 0;
+
+ int expectedValue = iterations * threads.Length;
+
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(this.SimpleIncrement));
+ threads[i].Start();
+ }
+
+ Thread.Sleep(100);
+ signal.Set();
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+
+ if (sharedValue == expectedValue)
+ return 100;
+
+ return -1;
+ }
+ public int Dec()
+ {
+ sharedValue = iterations * threads.Length;
+
+ int expectedValue = 0;
+
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(this.SimpleDecrement));
+ threads[i].Start();
+ }
+
+ Thread.Sleep(100);
+ signal.Set();
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+
+ if (sharedValue == expectedValue)
+ return 100;
+
+ return -1;
+ }
+ private void SimpleIncrement()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < iterations; i++)
+ Interlocked.Increment(ref sharedValue);
+ }
+ private void SimpleDecrement()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < iterations; i++)
+ Interlocked.Decrement(ref sharedValue);
+ }
+ public int CheckIncReturn()
+ {
+ int sharedValue;
+ int rValue = 0;
+
+ foreach (int val in IntVals)
+ {
+ sharedValue = val;
+ Console.WriteLine("Test for Inc with value {0}", val);
+ Console.WriteLine("Expected : {0}", val - 1);
+ int returnV = Interlocked.Increment(ref sharedValue);
+ if (val + 1 != returnV )
+ {
+ Console.WriteLine("Failed: Return value is wrong: {0}", returnV);
+ rValue = -1;
+ }
+ if (val + 1 != sharedValue)
+ {
+ Console.WriteLine("Failed: refence value is wrong: {0}", sharedValue);
+ rValue = -2;
+ }
+ }
+
+ if (rValue == 0)
+ rValue = 100;
+
+ return rValue;
+ }
+ public int CheckDecReturn()
+ {
+ int sharedValue;
+ int rValue =0;
+ foreach (int val in IntVals)
+ {
+ sharedValue = val;
+ Console.WriteLine("Test for Dec with value {0}", val);
+ Console.WriteLine("Expected : {0}", val - 1);
+ int returnV = Interlocked.Decrement(ref sharedValue);
+ if (val - 1 != returnV)
+ {
+ Console.WriteLine("Failed: Return value is wrong: {0}", returnV);
+ rValue = -1;
+ }
+ if (val -1 != sharedValue)
+ {
+ Console.WriteLine("Failed: refence value is wrong: {0}", sharedValue);
+ rValue = -2;
+ }
+ }
+ if(rValue == 0)
+ rValue = 100;
+ return rValue;
+ }
+ int[] IntVals = new int[5]
+ {
+ Int32.MinValue,
+ Int32.MaxValue,
+ 0,
+ -1,
+ 1
+ };
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong.csproj
new file mode 100644
index 0000000000..f8f3faaf93
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>/loops:100 /addVar:-922337203685477</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="compareexchangelong.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong_1.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong_1.csproj
new file mode 100644
index 0000000000..b5986d43ca
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>CompareExchangeLong.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>/loops:100 /addVar:-1</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong_2.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong_2.csproj
new file mode 100644
index 0000000000..a4d260596d
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>CompareExchangeLong.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>/loops:100 /addVar:12345</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong_3.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong_3.csproj
new file mode 100644
index 0000000000..e97258e434
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeLong_3.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>CompareExchangeLong.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>/loops:100 /addVar:922337203685477</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeTClass.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeTClass.csproj
new file mode 100644
index 0000000000..21873cffbc
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeTClass.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>null</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="compareexchangetclass.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeTClass_1.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeTClass_1.csproj
new file mode 100644
index 0000000000..9af3741086
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeTClass_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>CompareExchangeTClass.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>"hello world"</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeTString.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeTString.csproj
new file mode 100644
index 0000000000..c19ed90f6f
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/CompareExchangeTString.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>empty</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="compareexchangetstring.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange1_cti.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange1_cti.cs
new file mode 100644
index 0000000000..b7c1da2d76
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange1_cti.cs
@@ -0,0 +1,148 @@
+// 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.Threading;
+
+/// <summary>
+/// System.Threading.Interlocked.CompareExchange(Double,Double,Double)
+/// </summary>
+///
+
+// This test makes sure that CompareExchange(Double, Double, Double)
+// plays nicely with another thread accessing shared state directly
+public class InterlockedCompareExchange1
+{
+ public static double globalValue = 0.0;
+ public Thread threadA;
+ public Thread threadB;
+ public double state;
+
+
+ #region Public Methods
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+
+ return retVal;
+ }
+
+ #region Positive Test Cases
+ public bool PosTest1()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: Using another thread to change the value of variable in this thread");
+
+
+ try
+ {
+ // Spin up two new threads
+ threadA = new Thread(new ThreadStart(TestComChange));
+ threadB = new Thread(new ThreadStart(changeGlobal));
+ // Start Thread A
+ // Thread A runs TestComChange
+ threadA.Start();
+ // Block calling thread until spawned Thread A completes
+ threadA.Join();
+ // Once Thread A completes, block
+ // calling thread until Thread B completes as well
+ threadB.Join();
+ // now, the final value of globalValue and state should be -0.1
+ if (globalValue != -0.1 && state != -0.1)
+ {
+ TestLibrary.TestFramework.LogError("001", "The method did not works, the result is" + globalValue + " " + state);
+ retVal = false;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+ #endregion
+
+ #region Negetive Test Cases
+ public bool NegTest1()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.BeginScenario("NegTest1: ");
+
+ try
+ {
+
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("101", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+ #endregion
+ #endregion
+
+ public static int Main()
+ {
+ InterlockedCompareExchange1 test = new InterlockedCompareExchange1();
+
+ TestLibrary.TestFramework.BeginTestCase("InterlockedCompareExchange1");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+ public void TestComChange()
+ {
+ // loop 20 times. On the 0-9th times,
+ // only Thread A is accessing globalValue. it keeps
+ // checking if globalValue is 10, which it isn't (it
+ // starts at 0). but, on the 10th time, it starts
+ // Thread B, which at some point runs changeGlobal,
+ // setting globalValue to 10. After Thread B sets
+ // it to 10, the CompareExchange will fire, setting
+ // globalValue to -0.1. Thereafter, CompareExchange
+ // will see that globalValue is not 10, and keep
+ // returning -0.1 to state. each time thru the loop,
+ // Thread A does a sleep(10) so that Thread B has a
+ // chance to do its thing.
+ int i = 0;
+ while (i < 20)
+ {
+ if (i == 10)
+ {
+ threadB.Start();
+ }
+ state = Interlocked.CompareExchange(ref globalValue, -0.1, 10.0);
+ i++;
+ Thread.Sleep(10);
+ }
+ }
+ public void changeGlobal()
+ {
+ // Thread B is the only place this runs
+ // When it runs, it simply sets globalValue to 10.
+ // It should only do this once Thread A tells Thread B
+ // to start.
+ globalValue = 10.0;
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange1_cti.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange1_cti.csproj
new file mode 100644
index 0000000000..f7b3e9df7e
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange1_cti.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CompareExchange1_cti.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange2.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange2.cs
new file mode 100644
index 0000000000..19c307839e
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange2.cs
@@ -0,0 +1,361 @@
+// 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.Threading;
+
+// This tests CompareExchange(object, object, object).
+// It just casts a bunch of different value types to object,
+// then makes sure CompareExchange works on those objects.
+public class InterlockedCompareExchange2
+{
+ private const int c_NUM_LOOPS = 100;
+ private const int c_MIN_STRING_LEN = 5;
+ private const int c_MAX_STRING_LEN = 128;
+
+ public static int Main()
+ {
+ InterlockedCompareExchange2 test = new InterlockedCompareExchange2();
+
+ TestLibrary.TestFramework.BeginTestCase("InterlockedCompareExchange2");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+ retVal = PosTest2() && retVal;
+
+ return retVal;
+ }
+
+ // This particular test is for when the comparands are equal and the
+ // switch should take place.
+ public bool PosTest1()
+ {
+ bool retVal = true;
+ object location;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object Interlocked.CompareExchange(object&,object, object) where comparand is equal");
+
+ try
+ {
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == Byte");
+ location = (object)TestLibrary.Generator.GetByte();
+ retVal = ExchangeObjects(
+ true,
+ location,
+ location,
+ (object)TestLibrary.Generator.GetByte()
+ ) && retVal;
+ // Note that (&&) performs a logical-AND of
+ // its bool operands, but only evaluates its second
+ // operand if necessary. When ExchangeObjects is first
+ // called (above), retVal (RHS)
+ // is true, as it was initialized above. If ExchangeObjects
+ // returns true, then it checks retVal (RHS), it is also true,
+ // so retVal (LHS) gets set to true. This stays this
+ // way so long as ExchangeObjects returns true in this and
+ // subsequent calls.
+ // If some time ExchangeObjects returns false (0), this
+ // expression does not check retVal (RHS), and instead
+ // retVal (LHS) becomes false. Next call to ExchangeObjects,
+ // retVal (RHS) is false even if ExchangeObjects returns true, so
+ // retVal (both RHS and LHS) remains false for all
+ // subsequent calls to ExchangeObjects. As such, if any one of
+ // the many calls to ExchangeObjects fails, retVal returns false
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == Byte[]");
+ byte[] bArr1 = new Byte[5 + (TestLibrary.Generator.GetInt32() % 1024)];
+ byte[] bArr2 = new Byte[5 + (TestLibrary.Generator.GetInt32() % 1024)];
+ TestLibrary.Generator.GetBytes(bArr1);
+ TestLibrary.Generator.GetBytes(bArr2);
+ location = (object)bArr1;
+ retVal = ExchangeObjects(
+ true,
+ location,
+ location,
+ (object)bArr2
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == Int16");
+ location = (object)TestLibrary.Generator.GetInt16();
+ retVal = ExchangeObjects(
+ true,
+ location,
+ location,
+ (object)TestLibrary.Generator.GetInt16()
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == Int32");
+ location = (object)TestLibrary.Generator.GetInt32();
+ retVal = ExchangeObjects(
+ true,
+ location,
+ location,
+ (object)TestLibrary.Generator.GetInt32()
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == Int64");
+ location = (object)(object)TestLibrary.Generator.GetInt64();
+ retVal = ExchangeObjects(
+ true,
+ location,
+ location,
+ (object)TestLibrary.Generator.GetInt64()
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == Single");
+ location = (object)(object)TestLibrary.Generator.GetSingle();
+ retVal = ExchangeObjects(
+ true,
+ location,
+ location,
+ (object)TestLibrary.Generator.GetSingle()
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == Double");
+ location = (object)(object)TestLibrary.Generator.GetDouble();
+ retVal = ExchangeObjects(
+ true,
+ location,
+ location,
+ (object)TestLibrary.Generator.GetDouble()
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == string");
+ location = TestLibrary.Generator.GetString(false, c_MIN_STRING_LEN, c_MAX_STRING_LEN);
+ retVal = ExchangeObjects(
+ true,
+ location,
+ location,
+ (object)TestLibrary.Generator.GetString(false, c_MIN_STRING_LEN, c_MAX_STRING_LEN)
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == char");
+ location = TestLibrary.Generator.GetChar();
+ retVal = ExchangeObjects(
+ true,
+ location,
+ location,
+ (object)TestLibrary.Generator.GetChar()
+ ) && retVal;
+
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+ // This particular test is for when the comparands are not equal and the
+ // switch should not take place.
+ public bool PosTest2()
+ {
+ bool retVal = true;
+ object location;
+ object other;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest2: object Interlocked.CompareExchange(object&,object, object) where comparand are not equal");
+
+ try
+ {
+ TestLibrary.TestFramework.BeginScenario("PosTest2: object == Byte");
+ location = (object)TestLibrary.Generator.GetByte();
+ other = (object)TestLibrary.Generator.GetByte();
+
+ retVal = ExchangeObjects(
+ false,
+ location,
+ (object)((byte)location+1),
+ other
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest2: object == Byte[]");
+ byte[] bArr1 = new Byte[5 + (TestLibrary.Generator.GetInt32() % 1024)];
+ byte[] bArr2 = new Byte[5 + (TestLibrary.Generator.GetInt32() % 1024)];
+ byte[] bArr3 = new Byte[5 + (TestLibrary.Generator.GetInt32() % 1024)];
+ TestLibrary.Generator.GetBytes(bArr1);
+ TestLibrary.Generator.GetBytes(bArr2);
+ TestLibrary.Generator.GetBytes(bArr3);
+ location = (object)bArr1;
+ retVal = ExchangeObjects(
+ false,
+ location,
+ (object)bArr2,
+ (object)bArr3
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest2: object == Int16");
+ location = (object)TestLibrary.Generator.GetInt16();
+ other = (object)TestLibrary.Generator.GetInt16();
+
+ retVal = ExchangeObjects(
+ false,
+ location,
+ (object)((Int16)location+1),
+ other
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest2: object == Int32");
+ location = (object)TestLibrary.Generator.GetInt32();
+ other = (object)TestLibrary.Generator.GetInt32();
+
+ retVal = ExchangeObjects(
+ false,
+ location,
+ (object)((Int32)location+1),
+ other
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest2: object == Int64");
+ location = (object)(object)TestLibrary.Generator.GetInt64();
+ other = (object)TestLibrary.Generator.GetInt64();
+
+ retVal = ExchangeObjects(
+ false,
+ location,
+ (object)((Int64)location+1),
+ other
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest2: object == Single");
+ location = (object)(object)TestLibrary.Generator.GetSingle();
+ other = (object)TestLibrary.Generator.GetSingle();
+
+ retVal = ExchangeObjects(
+ false,
+ location,
+ (object)((Single)location+1),
+ other
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest2: object == Double");
+ location = (object)(object)TestLibrary.Generator.GetDouble();
+ other = (object)TestLibrary.Generator.GetDouble();
+
+ retVal = ExchangeObjects(
+ false,
+ location,
+ (object)((Double)location+1),
+ other
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == string");
+ location = TestLibrary.Generator.GetString(false, c_MIN_STRING_LEN, c_MAX_STRING_LEN);
+ retVal = ExchangeObjects(
+ false,
+ location,
+ (string)location+TestLibrary.Generator.GetChar(),
+ (object)TestLibrary.Generator.GetDouble()
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == char");
+ location = TestLibrary.Generator.GetChar();
+ object comparand;
+ do
+ {
+ comparand = TestLibrary.Generator.GetChar();
+ }
+ while(comparand == location);
+ retVal = ExchangeObjects(
+ false,
+ location,
+ comparand,
+ (object)TestLibrary.Generator.GetChar()
+ ) && retVal;
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("001", "Unexpected exception: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+ public bool ExchangeObjects(bool exchange, object location, object comparand, object value)
+ {
+ bool retVal = true;
+ object oldLocation;
+ object originalLocation = location;
+
+ if (!exchange && comparand == location)
+ {
+ TestLibrary.TestFramework.LogError("003", "Comparand and location are equal unexpectadly!!!!");
+ retVal = false;
+ }
+ if (exchange && comparand != location)
+ {
+ TestLibrary.TestFramework.LogError("004", "Comparand and location are not equal unexpectadly!!!!");
+ retVal = false;
+ }
+
+ // this is the only significant difference between this test
+ // and InterlockedCompareExchange7.cs - here we use the
+ // object overload directly.
+ oldLocation = Interlocked.CompareExchange(ref location, value, comparand);
+
+ // if exchange=true, then the exchange was supposed to take place.
+ // as a result, assuming value did not equal comparand initially,
+ // and location did equal comparand initially, then we should
+ // expect the following:
+ // oldLoc holds locations old value,oldLocation == comparand, because oldLocation equals what
+ // location equaled before the exchange, and that
+ // equaled comparand
+ // location == value, because the exchange took place
+
+ if (exchange)
+ {
+ if (!Object.ReferenceEquals(location,value))
+ {
+ TestLibrary.TestFramework.LogError("005", "Interlocked.CompareExchange() did not do the exchange correctly: Expected location(" + location + ") to equal value(" + value + ")");
+ retVal = false;
+ }
+ if (!Object.ReferenceEquals(oldLocation,originalLocation))
+ {
+ TestLibrary.TestFramework.LogError("006", "Interlocked.CompareExchange() did not return the expected value: Expected oldLocation(" + oldLocation + ") to equal originalLocation(" + originalLocation + ")");
+ retVal = false;
+ }
+ }
+ // if exchange!=true, then the exchange was supposed to NOT take place.
+ // expect the following:
+ // location == originalLocation, because the exchange did not happen
+ // oldLocation == originalLocation, because the exchange did not happen
+ else
+ {
+ if (!Object.ReferenceEquals(location,originalLocation))
+ {
+ TestLibrary.TestFramework.LogError("007", "Interlocked.CompareExchange() should not change the location: Expected location(" + location + ") to equal originalLocation(" + originalLocation + ")");
+ retVal = false;
+ }
+ if (!Object.ReferenceEquals(oldLocation,originalLocation))
+ {
+ TestLibrary.TestFramework.LogError("008", "Interlocked.CompareExchange() did not return the expected value: Expected oldLocation(" + oldLocation + ") to equal originalLocation(" + originalLocation + ")");
+ retVal = false;
+ }
+ }
+
+ return retVal;
+ }
+
+}
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange2.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange2.csproj
new file mode 100644
index 0000000000..25125f41a5
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange2.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CompareExchange2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange3.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange3.cs
new file mode 100644
index 0000000000..5b8fb96f26
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange3.cs
@@ -0,0 +1,167 @@
+// 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.Threading;
+
+// Tests that CompareExchange(Double, Double, Double)
+// actually switches values when location = comparand and
+// does not when it does not
+public class InterlockedCompareExchange3
+{
+ private const int c_NUM_LOOPS = 100;
+
+ public static int Main()
+ {
+ InterlockedCompareExchange3 test = new InterlockedCompareExchange3();
+
+ TestLibrary.TestFramework.BeginTestCase("InterlockedCompareExchange3");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+ retVal = PosTest2() && retVal;
+
+ return retVal;
+ }
+
+ // This test iterates 100 times. Each time it gets two
+ // Doubles, value and location. It stores location in comparand, so
+ // they will be equal on comparison. It then uses
+ // Interlocked.CompareExchange to compare location with comparand.
+ // Since they are equal, it must exchange: location is replaced by
+ // value, and the original value in location is returned to oldLocation.
+ // Then it checks that location now equals value, and that oldLocation
+ // equals comparand. If either of these are not true, retVal gets set to
+ // false, and ultimately it returns false. since location is never null,
+ // it should not throw an exception, so doing so causes the test
+ // to fail.
+ public bool PosTest1()
+ {
+ bool retVal = true;
+ Double location;
+ Double value;
+ Double comparand;
+ Double oldLocation;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: Double Interlocked.CompareExchange(Double&,Double,Double) where comparand is equal");
+
+ try
+ {
+ for (int i=0; i<c_NUM_LOOPS; i++)
+ {
+ value = TestLibrary.Generator.GetDouble();
+ location = TestLibrary.Generator.GetDouble();
+ comparand = location;
+
+ oldLocation = Interlocked.CompareExchange(ref location, value, comparand);
+ // At this point, we should be able to make
+ // the following assertion:
+ // location = value
+ // oldLocation = comparand
+
+ if (!location.Equals(value))
+ {
+ TestLibrary.TestFramework.LogError("001", "Interlocked.CompareExchange() did not do the exchange correctly: Expected(" + value + ") Actual(" + location + ")");
+ retVal = false;
+ }
+
+ if (!oldLocation.Equals(comparand))
+ {
+ TestLibrary.TestFramework.LogError("002", "Interlocked.CompareExchange() did not return the expected value: Expected(" + comparand + ") Actual(" + oldLocation + ")");
+ retVal = false;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ // since location is not null, any exception
+ // causes test failure.
+ TestLibrary.TestFramework.LogError("003", "Unexpected exception: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+ // This test iterates 100 times. Each time it gets two
+ // Doubles, value and location. It then gets a value for comparand, such
+ // that it is NOT EQUAL to location. It then uses
+ // Interlocked.CompareExchange to compare location with comparand.
+ // Since they are not equal, it does not exchange.
+ // since location is never null,
+ // it should not throw an exception, so doing so causes the test
+ // to fail.
+ public bool PosTest2()
+ {
+ bool retVal = true;
+ Double location;
+ Double value;
+ Double comparand;
+ Double oldLocation;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest2: Double Interlocked.CompareExchange(Double&,Double,Double) where comparand are not equal");
+
+ try
+ {
+ for (int i=0; i<c_NUM_LOOPS; i++)
+ {
+ value = TestLibrary.Generator.GetDouble();
+ location = TestLibrary.Generator.GetDouble();
+ comparand = value;
+ while(comparand.Equals(location))
+ {
+ comparand = TestLibrary.Generator.GetDouble();
+ }
+
+ oldLocation = Interlocked.CompareExchange(ref location, value, comparand);
+ // At this point, we should be able to make
+ // the following assertions:
+ // location != value
+ // location != comparand
+ // location = oldLocation
+ // oldLocation != comparand
+
+ if (location.Equals(value))
+ {
+ TestLibrary.TestFramework.LogError("004", "Interlocked.CompareExchange() did not do the exchange correctly: Expected(" + value + ") Actual(" + location + ")");
+ retVal = false;
+ }
+
+ if (oldLocation.Equals(comparand))
+ {
+ TestLibrary.TestFramework.LogError("005", "Interlocked.CompareExchange() did not return the expected value: Expected(" + location + ") Actual(" + oldLocation + ")");
+ retVal = false;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ // since location is not null, any exception
+ // causes test failure.
+ TestLibrary.TestFramework.LogError("006", "Unexpected exception: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+}
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange3.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange3.csproj
new file mode 100644
index 0000000000..f792ecc72b
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange3.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CompareExchange3.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange4.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange4.cs
new file mode 100644
index 0000000000..a777b6fba9
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange4.cs
@@ -0,0 +1,168 @@
+// 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.Threading;
+
+// Tests that CompareExchange(Single, Single, Single)
+// a.k.a., CompareExchange(float, float, float)
+// actually switches values when location = comparand and
+// does not when it does not
+public class InterlockedCompareExchange4
+{
+ private const int c_NUM_LOOPS = 100;
+
+ public static int Main()
+ {
+ InterlockedCompareExchange4 test = new InterlockedCompareExchange4();
+
+ TestLibrary.TestFramework.BeginTestCase("InterlockedCompareExchange4");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+ retVal = PosTest2() && retVal;
+
+ return retVal;
+ }
+
+ // This test iterates 100 times. Each time it gets two
+ // Singles, value and location. It stores location in comparand, so
+ // they will be equal on comparison. It then uses
+ // Interlocked.CompareExchange to compare location with comparand.
+ // Since they are equal, it must exchange: location is replaced by
+ // value, and the original value in location is returned to oldLocation.
+ // Then it checks that location now equals value, and that oldLocation
+ // equals comparand. If either of these are not true, retVal gets set to
+ // false, and ultimately it returns false. since location is never null,
+ // it should not throw an exception, so doing so causes the test
+ // to fail.
+ public bool PosTest1()
+ {
+ bool retVal = true;
+ Single location;
+ Single value;
+ Single comparand;
+ Single oldLocation;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: Single Interlocked.CompareExchange(Single&,Single,Single) where comparand is equal");
+
+ try
+ {
+ for (int i=0; i<c_NUM_LOOPS; i++)
+ {
+ value = TestLibrary.Generator.GetSingle();
+ location = TestLibrary.Generator.GetSingle();
+ comparand = location;
+
+ oldLocation = Interlocked.CompareExchange(ref location, value, comparand);
+ // At this point, we should be able to make
+ // the following assertion:
+ // location = value
+ // oldLocation = comparand
+
+ if (!location.Equals(value))
+ {
+ TestLibrary.TestFramework.LogError("001", "Interlocked.CompareExchange() did not do the exchange correctly: Expected(" + value + ") Actual(" + location + ")");
+ retVal = false;
+ }
+
+ if (!oldLocation.Equals(comparand))
+ {
+ TestLibrary.TestFramework.LogError("002", "Interlocked.CompareExchange() did not return the expected value: Expected(" + comparand + ") Actual(" + oldLocation + ")");
+ retVal = false;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ // since location is not null, any exception
+ // causes test failure.
+ TestLibrary.TestFramework.LogError("003", "Unexpected exception: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+ // This test iterates 100 times. Each time it gets two
+ // Singles, value and location. It then gets a value for comparand, such
+ // that it is NOT EQUAL to location. It then uses
+ // Interlocked.CompareExchange to compare location with comparand.
+ // Since they are not equal, it does not exchange.
+ // since location is never null,
+ // it should not throw an exception, so doing so causes the test
+ // to fail.
+ public bool PosTest2()
+ {
+ bool retVal = true;
+ Single location;
+ Single value;
+ Single comparand;
+ Single oldLocation;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest2: Single Interlocked.CompareExchange(Single&,Single,Single) where comparand are not equal");
+
+ try
+ {
+ for (int i=0; i<c_NUM_LOOPS; i++)
+ {
+ value = TestLibrary.Generator.GetSingle();
+ location = TestLibrary.Generator.GetSingle();
+ comparand = value;
+ while(comparand.Equals(location))
+ {
+ comparand = TestLibrary.Generator.GetSingle();
+ }
+
+ oldLocation = Interlocked.CompareExchange(ref location, value, comparand);
+ // At this point, we should be able to make
+ // the following assertions:
+ // location != value
+ // location != comparand
+ // location = oldLocation
+ // oldLocation != comparand
+
+ if (location.Equals(value))
+ {
+ TestLibrary.TestFramework.LogError("004", "Interlocked.CompareExchange() did not do the exchange correctly: Expected(" + value + ") Actual(" + location + ")");
+ retVal = false;
+ }
+
+ if (oldLocation.Equals(comparand))
+ {
+ TestLibrary.TestFramework.LogError("005", "Interlocked.CompareExchange() did not return the expected value: Expected(" + comparand + ") Actual(" + oldLocation + ")");
+ retVal = false;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ // since location is not null, any exception
+ // causes test failure.
+ TestLibrary.TestFramework.LogError("006", "Unexpected exception: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+}
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange4.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange4.csproj
new file mode 100644
index 0000000000..ef093d2431
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange4.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CompareExchange4.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange5_cti.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange5_cti.cs
new file mode 100644
index 0000000000..f703ab948b
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange5_cti.cs
@@ -0,0 +1,252 @@
+// 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.Threading;
+
+/// <summary>
+/// System.Threading.Interlocked.CompareExchange(ref object,object,object)
+/// </summary>
+
+// Tests that CompareExchange(object, object, object)
+// plays nicely with another thread accessing shared state directly
+// Also includes a test for when location = comparand = null (should
+// switch).
+public class InterlockedCompareExchange5
+{
+ public static object globalValue;
+ public Thread threadA;
+ public Thread threadB;
+ public object state;
+ public myClass obMyClass;
+
+ #region Public Methods
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+ retVal = PosTest2() && retVal;
+ retVal = PosTest3() && retVal;
+
+ return retVal;
+ }
+
+ #region Positive Test Cases
+ public bool PosTest1()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: The object is a string");
+
+ try
+ {
+ // Spin up two new threads
+ threadA = new Thread(new ThreadStart(TestComChange));
+ threadB = new Thread(new ThreadStart(changeGlobal));
+ // Start Thread A
+ // Thread A runs TestComChange
+ threadA.Start();
+ // Block spawning thread until Thread A completes
+ threadA.Join();
+ // Once Thread A completes, block spawning thread
+ // until Thread B completes as well
+ threadB.Join();
+ // now, the final values of
+ // globalValue and state should be "changedValue"
+ if (globalValue.ToString() != "changedValue" && state != (object)("changedValue"))
+ {
+ TestLibrary.TestFramework.LogError("001", "The method did not works, the result is" + globalValue + " " + state);
+ retVal = false;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+ public bool PosTest2()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest2: The object is a custom class");
+
+ obMyClass = new myClass(123456789);
+ try
+ {
+ // Spin up two new threads
+ threadA = new Thread(new ThreadStart(TestComChange2));
+ threadB = new Thread(new ThreadStart(changeGlobal2));
+ // Start Thread A
+ // Thread A runs TestComChange2
+ threadA.Start();
+ // Block spawning thread until Thread A completes
+ threadA.Join();
+ // Once Thread A completes, block spawning thread
+ // until Thread B completes as well
+ threadB.Join();
+ // now, the final values of
+ // globalValue and state should NOT be -100
+ if (((myClass)globalValue).a != -100 && ((myClass)state).a != -100)
+ {
+ TestLibrary.TestFramework.LogError("003", "The method did not works, the result is" + globalValue + " " + state);
+ retVal = false;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("004", "Unexpected exception: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+ public bool PosTest3()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest3: The first argument is a null reference");
+
+ try
+ {
+ // a non-null object
+ object value = new myClass(-100);
+ // a null object
+ object comparand = null;
+ // a null initial state
+ globalValue = null;
+ // globalValue is null, so it should switch
+ // and return null
+ // this is a major difference with
+ // InterlockedCompareExchange8.cs --
+ // here we use the object overload
+ state = Interlocked.CompareExchange(ref globalValue, value, comparand);
+ // globalValue should equal value now
+ if (globalValue != value)
+ {
+ TestLibrary.TestFramework.LogError("005", "The method did not works, the result is" + globalValue + " " + state);
+ retVal = false;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("006", "Unexpected exception: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+ #endregion
+ #region Negative Test Cases
+ #endregion
+ #endregion
+
+ public static int Main()
+ {
+ InterlockedCompareExchange5 test = new InterlockedCompareExchange5();
+
+ TestLibrary.TestFramework.BeginTestCase("InterlockedCompareExchange5");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+ public void TestComChange()
+ {
+ // set a value
+ object value = "changedValue";
+ // set a different value
+ object comparand = "comparand";
+ int i = 0;
+ // loop 20 times
+ while (i < 20)
+ {
+ // first ten times, we just skip this
+ // then on the tenth time, fire Thread B,
+ // setting globalValue to "Comparand"
+ if (i == 10)
+ {
+ threadB.Start();
+ }
+ // first ten iterations, globalValue does not
+ // equal comparand, so it keeps returning
+ // the contents of globalValue without
+ // poking value into it
+ // after ten, Thread B kicks in, and
+ // it matches, subsequently, globalValue
+ // gets set to "changedValue"
+ // this is a major difference with
+ // InterlockedCompareExchange8.cs --
+ // here we use the object overload
+ state = Interlocked.CompareExchange(ref globalValue, value, comparand);
+ i++;
+ Thread.Sleep(10);
+ }
+ }
+ public void changeGlobal()
+ {
+ // set when B runs
+ globalValue = "comparand";
+ }
+
+ public void TestComChange2()
+ {
+ // set a value
+ object value = new myClass(-100);
+ // set a different value
+ object comparand = obMyClass;
+ int i = 0;
+ // loop 20 times
+ while (i < 20)
+ {
+ // first ten times, we just skip this
+ // then on the tenth time, fire Thread B,
+ // setting globalValue to obMyClass
+ if (i == 10)
+ {
+ threadB.Start();
+ }
+ // first ten iterations, globalValue does not
+ // equal comparand, so it keeps returning
+ // the contents of globalValue without
+ // poking value into it
+ // after ten, Thread B kicks in, and
+ // it matches, subsequently, globalValue
+ // gets set to point to where value does
+ // this is a major difference with
+ // InterlockedCompareExchange8.cs --
+ // here we use the object overload
+ state = Interlocked.CompareExchange(ref globalValue, value, comparand);
+ i++;
+ Thread.Sleep(10);
+ }
+ }
+ public void changeGlobal2()
+ {
+ globalValue = obMyClass;
+ }
+}
+public class myClass
+{
+ public int a;
+ public myClass(int value)
+ {
+ a = value;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange5_cti.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange5_cti.csproj
new file mode 100644
index 0000000000..d47f2f8b14
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchange5_cti.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CompareExchange5_cti.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangedouble.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangedouble.cs
new file mode 100644
index 0000000000..02fffd9862
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangedouble.cs
@@ -0,0 +1,120 @@
+// 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.Threading;
+using System.Globalization;
+
+namespace CompareExchangeDouble
+{
+ class CompareExchangeDouble
+ {
+ static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: CompareExchangeDouble " +
+ "/loops:<int> /addVal:<double>");
+ return -1;
+ }
+
+ // Get the args
+ int loops=100;
+ double valueToAdd = 1E+100;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/loops:"))
+ {
+ loops = Convert.ToInt32(args[i].Substring(7));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/addval:"))
+ {
+ CultureInfo myCultureInfo = new CultureInfo("en-US");
+ valueToAdd = Double.Parse(args[i].Substring(8), myCultureInfo);
+ continue;
+ }
+ }
+
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe(loops,valueToAdd);
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorker));
+ threads[i].Start();
+ }
+
+ tsi.Signal();
+
+ for(int i=0;i<threads.Length;i++)
+ threads[i].Join();
+ double expected = 0.0D;
+ for(int i=0;i<threads.Length*loops;i++)
+ expected = (double)(expected + valueToAdd);
+ if(tsi.Total == expected)
+ rValue = 100;
+ Console.WriteLine("Expected: "+expected);
+ Console.WriteLine("Actual : "+tsi.Total);
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ManualResetEvent signal;
+ private double totalValue = 0D;
+ private int numberOfIterations;
+ private double valueToAdd;
+ public ThreadSafe(): this(100,1E+100) { }
+ public ThreadSafe(int loops, double addend)
+ {
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ valueToAdd = addend;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorker()
+ {
+ signal.WaitOne();
+ for(int i=0;i<numberOfIterations;i++)
+ AddToTotal(valueToAdd);
+ }
+
+ public double Expected
+ {
+ get
+ {
+ return (numberOfIterations * valueToAdd);
+ }
+ }
+
+ public double Total
+ {
+ get { return totalValue; }
+ }
+
+ private double AddToTotal(double addend)
+ {
+ double initialValue, computedValue;
+ do
+ {
+ initialValue = totalValue;
+ computedValue = (double)(initialValue + addend);
+ }
+ while (initialValue != Interlocked.CompareExchange(
+ ref totalValue, computedValue, initialValue));
+ return computedValue;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangedouble.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangedouble.csproj
new file mode 100644
index 0000000000..c7275a0b9a
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangedouble.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/loops:100 /addVal:1.79769313486232E+304</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CompareExchangeDouble.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangefloat.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangefloat.cs
new file mode 100644
index 0000000000..9ffe170ec2
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangefloat.cs
@@ -0,0 +1,98 @@
+// 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.Threading;
+
+namespace Exchange
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ class Class1
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static int Main(string[] args)
+ {
+ int loops = 100;
+ int rValue = 0;
+ if(args.Length == 1)
+ loops = Int32.Parse(args[0]);
+ float valuetoadd = 10.12345F;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe(100,valuetoadd);
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorker));
+ threads[i].Start();
+ }
+
+ tsi.Signal();
+
+ for(int i=0;i<threads.Length;i++)
+ threads[i].Join();
+ float expected = 0.0F;
+ for(int i=0;i<threads.Length*loops;i++)
+ expected = (float)(expected + valuetoadd);
+ if(tsi.Total == expected)
+ rValue = 100;
+ Console.WriteLine("Expected: "+expected);
+ Console.WriteLine("Actual : "+tsi.Total);
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ManualResetEvent signal;
+ private float totalValue = 0F;
+ private int numberOfIterations;
+ private float valueToAdd;
+ public ThreadSafe(): this(100,10.12345F) { }
+ public ThreadSafe(int loops, float addend)
+ {
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ valueToAdd = addend;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorker()
+ {
+ signal.WaitOne();
+ for(int i=0;i<numberOfIterations;i++)
+ AddToTotal(valueToAdd);
+
+ }
+ public float Expected
+ {
+ get
+ {
+ return (numberOfIterations * valueToAdd);
+ }
+ }
+ public float Total
+ {
+ get { return totalValue; }
+ }
+ private float AddToTotal(float addend)
+ {
+ float initialValue, computedValue;
+ do
+ {
+ initialValue = totalValue;
+ computedValue = (float)(initialValue + addend);
+ } while (initialValue != Interlocked.CompareExchange(ref totalValue, computedValue, initialValue));
+ return computedValue;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangefloat.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangefloat.csproj
new file mode 100644
index 0000000000..289cc69e39
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangefloat.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="..\common\InterlockedHelper_CoreCLR.cs" />
+ <Compile Include="CompareExchangeFloat.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeint.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeint.cs
new file mode 100644
index 0000000000..d66fd51240
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeint.cs
@@ -0,0 +1,91 @@
+// 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.Threading;
+
+namespace Exchange
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ class Class1
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+
+ static int Main(string[] args)
+ {
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe();
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorker));
+ threads[i].Start();
+ }
+
+ tsi.Signal();
+
+ for(int i=0;i<threads.Length;i++)
+ threads[i].Join();
+
+ if(tsi.Total == tsi.Expected * threads.Length)
+ rValue = 100;
+ Console.WriteLine("Test Expected {0}, but found {1}", tsi.Expected * threads.Length, tsi.Total);
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ManualResetEvent signal;
+ private int totalValue = 0;
+ private int numberOfIterations;
+ private int valueToAdd;
+ public ThreadSafe(): this(100,100) { }
+ public ThreadSafe(int loops, int addend)
+ {
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ valueToAdd = addend;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorker()
+ {
+ signal.WaitOne();
+ for(int i=0;i<numberOfIterations;i++)
+ AddToTotal(valueToAdd);
+
+ }
+ public int Expected
+ {
+ get
+ {
+ return (numberOfIterations * valueToAdd);
+ }
+ }
+ public int Total
+ {
+ get { return totalValue; }
+ }
+ private int AddToTotal(int addend)
+ {
+ int initialValue, computedValue;
+ do
+ {
+ initialValue = totalValue;
+ computedValue = initialValue + addend;
+ } while (initialValue != Interlocked.CompareExchange(ref totalValue, computedValue, initialValue));
+ return computedValue;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeint.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeint.csproj
new file mode 100644
index 0000000000..5d26cd3e73
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeint.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="..\common\InterlockedHelper_CoreCLR.cs" />
+ <Compile Include="CompareExchangeInt.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeintptr.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeintptr.cs
new file mode 100644
index 0000000000..9010b3e762
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeintptr.cs
@@ -0,0 +1,87 @@
+// 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.Threading;
+using System.Collections;
+
+namespace Exchange
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ class Class1
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static int Main(string[] args)
+ {
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe(threads.Length);
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(tsi.ChangeValue));
+ threads[i].Name = i.ToString();
+ threads[i].Start();
+ }
+
+ tsi.Signal();
+
+ for(int i=0;i<threads.Length;i++)
+ threads[i].Join();
+
+ if(tsi.Success)
+ rValue = 100;
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ private int threadCount;
+ ManualResetEvent signal;
+ private IntPtr mValue;
+ private int accessCount;
+ private static object myLock = new Object();
+
+ public ThreadSafe(int size)
+ {
+ threadCount = size;
+ mValue = IntPtr.Zero;
+ signal = new ManualResetEvent(false);
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+ public bool Success
+ {
+ get {
+ Console.WriteLine("AccessCount {0} should equal threadCount {1}", accessCount, threadCount);
+ Console.WriteLine("mValue.ToInt32 {0} should equal threadCount {1}", mValue.ToInt32(), threadCount);
+ return (accessCount == threadCount) && (mValue.ToInt32() == threadCount);
+ }
+ }
+ public void ChangeValue()
+ {
+ IntPtr initialValue, newValue;
+
+ signal.WaitOne();
+ do
+ {
+ initialValue = mValue;
+ lock (myLock)
+ {
+ newValue = new IntPtr(mValue.ToInt32() + 1);
+ }
+ } while (initialValue != Interlocked.CompareExchange(ref mValue, newValue, initialValue));
+ Interlocked.Increment(ref accessCount);
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeintptr.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeintptr.csproj
new file mode 100644
index 0000000000..a49fafc20f
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeintptr.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="..\common\InterlockedHelper_CoreCLR.cs" />
+ <Compile Include="CompareExchangeIntPtr.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangelong.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangelong.cs
new file mode 100644
index 0000000000..d4e55a4867
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangelong.cs
@@ -0,0 +1,116 @@
+// 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.Threading;
+
+namespace CompareExchangeLong
+{
+ class CompareExchangeLong
+ {
+ static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: CompareExchangeLong " +
+ "/loops:<int> /addVal:<long>");
+ return -1;
+ }
+
+ // Get the args
+ int loops=100;
+ long valueToAdd = 0;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/loops:"))
+ {
+ loops = Convert.ToInt32(args[i].Substring(7));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/addval:"))
+ {
+ valueToAdd = Convert.ToInt64(args[i].Substring(8));
+ continue;
+ }
+ }
+
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe(loops, valueToAdd);
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorker));
+ threads[i].Start();
+ }
+
+ tsi.Signal();
+
+ for(int i=0;i<threads.Length;i++)
+ threads[i].Join();
+
+ if(tsi.Total == tsi.Expected * threads.Length)
+ rValue = 100;
+ Console.WriteLine("Expected: "+ (tsi.Expected * threads.Length));
+ Console.WriteLine("Actual : "+ tsi.Total);
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ManualResetEvent signal;
+ private long totalValue = 0;
+ private int numberOfIterations;
+ private long valueToAdd;
+ public ThreadSafe(): this(100,Int64.MaxValue) { }
+ public ThreadSafe(int loops, long value)
+ {
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ valueToAdd = value;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorker()
+ {
+ signal.Set();
+ for(int i=0;i<numberOfIterations;i++)
+ AddToTotal(valueToAdd);
+ }
+
+ public long Expected
+ {
+ get
+ {
+ return (numberOfIterations * valueToAdd);
+ }
+ }
+
+ public long Total
+ {
+ get { return totalValue; }
+ }
+
+ private long AddToTotal(long addend)
+ {
+ long initialValue, computedValue;
+ signal.WaitOne();
+ do
+ {
+ initialValue = totalValue;
+ computedValue = initialValue + addend;
+ }
+ while (initialValue != Interlocked.CompareExchange(ref totalValue,
+ computedValue, initialValue));
+ return computedValue;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeobject.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeobject.cs
new file mode 100644
index 0000000000..f135e156fb
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeobject.cs
@@ -0,0 +1,101 @@
+// 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.Threading;
+using System.Collections;
+
+namespace Exchange
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ class Class1
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static int Main(string[] args)
+ {
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe(threads.Length);
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(tsi.ChangeValue));
+ threads[i].Name = i.ToString();
+ threads[i].Start();
+ }
+
+ tsi.Signal();
+
+ for(int i=0;i<threads.Length;i++)
+ threads[i].Join();
+
+ if(tsi.Success)
+ rValue = 100;
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ArrayList myObjArray;
+ ArrayList postObjArray;
+ ManualResetEvent signal;
+ private Object mValue;
+ private int accessCount;
+ public ThreadSafe(int arraySize)
+ {
+ accessCount = 0;
+ mValue = null;
+ postObjArray = new ArrayList(arraySize + 1);
+ myObjArray = new ArrayList(arraySize+1);
+ for(int i=0;i<arraySize;i++)
+ myObjArray.Add(new Object());
+ signal = new ManualResetEvent(false);
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+ public bool Success
+ {
+ get
+ {
+ for (int i = 0; i < postObjArray.Count; i++)
+ for (int j = i+1; j < postObjArray.Count; j++)
+ if (postObjArray[i] == postObjArray[j])
+ {
+ Console.WriteLine("Failure!!!!");
+ Console.WriteLine("ValueOne:" + postObjArray[i]);
+ Console.WriteLine("ValueTwo:" + postObjArray[j]);
+ Console.WriteLine("Position:" + i + " " + j);
+ return false;
+ }
+ //No dups so check for proper count
+ Console.WriteLine("Expect accessCount {0} to equal postObjArray.Count {1}", accessCount, postObjArray.Count);
+ return (accessCount == (postObjArray.Count));
+ }
+ }
+ public void ChangeValue()
+ {
+ Object initialValue, newValue;
+ signal.WaitOne();
+ do
+ {
+ initialValue = mValue;
+ newValue = myObjArray[Int32.Parse(Thread.CurrentThread.Name)];
+ } while (initialValue != Interlocked.CompareExchange(ref mValue, newValue, initialValue));
+ lock (this)
+ {
+ postObjArray.Add(initialValue);
+ }
+ Interlocked.Increment(ref accessCount);
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeobject.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeobject.csproj
new file mode 100644
index 0000000000..d2e82e102b
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangeobject.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="..\common\InterlockedHelper_CoreCLR.cs" />
+ <Compile Include="CompareExchangeObject.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchanget.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchanget.cs
new file mode 100644
index 0000000000..15c230f15a
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchanget.cs
@@ -0,0 +1,57 @@
+// 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.Threading;
+
+public class Test
+{
+
+ public static int Main()
+ {
+ Console.WriteLine("Start");
+ int retVal = 100;
+ string STORAGE = "OLD";
+ string NOW = "NOW";
+ string ret = "";
+
+ Console.WriteLine("ref loc: " + STORAGE);
+ Console.WriteLine("Return: " + ret);
+ Console.WriteLine("Comparand:" + STORAGE);
+ Console.WriteLine("Attempting Exchange in:" + NOW);
+
+ string OLDSTORAGE = STORAGE;
+ ret = Interlocked.CompareExchange<string>(ref STORAGE,NOW,STORAGE);
+
+ Console.WriteLine("ref loc: " + STORAGE);
+ Console.WriteLine("Return: " + ret);
+
+ //if(ret == "" || STORAGE != NOW)
+ if(ret != OLDSTORAGE || STORAGE != NOW)
+ retVal = -1;
+
+ Console.WriteLine(100 == retVal ? "Test Passed":"Test Failed");
+
+
+ STORAGE = "OLD";
+ NOW = "NOW";
+ ret = "";
+
+ Console.WriteLine("==================================");
+ Console.WriteLine("ref loc: " + STORAGE);
+ Console.WriteLine("Return: " + ret);
+ Console.WriteLine("Comparand:" + NOW);
+ Console.WriteLine("Attempting Exchange in:" + NOW);
+
+ ret = Interlocked.CompareExchange<string>(ref STORAGE,NOW,NOW);
+
+ Console.WriteLine("ref loc: " + STORAGE);
+ Console.WriteLine("Return: " + ret);
+ if(ret != "OLD" || STORAGE != "OLD")
+ retVal = -1;
+
+ Console.WriteLine(100 == retVal ? "Test Passed":"Test Failed");
+ return retVal;
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchanget.csproj b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchanget.csproj
new file mode 100644
index 0000000000..aa86ae9930
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchanget.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CompareExchangeT.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangetclass.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangetclass.cs
new file mode 100644
index 0000000000..a119d6b8da
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangetclass.cs
@@ -0,0 +1,145 @@
+// 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.Threading;
+
+class Class1
+{
+
+ static int Main(string[] args)
+ {
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe();
+
+ KrisClass kcIn = new KrisClass(args[0]);
+
+ Console.WriteLine("Creating threads");
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ParameterizedThreadStart(tsi.ThreadWorker));
+ threads[i].Start(kcIn);
+ }
+
+ tsi.Signal();
+
+ Console.WriteLine("Joining threads");
+ for(int i=0;i<threads.Length;i++)
+ threads[i].Join();
+
+ // Build the expected string
+ KrisClass kcExpected = new KrisClass("hello world! ");
+ for(int i=0;i<threads.Length * 100;i++)
+ kcExpected = kcExpected + kcIn;
+
+ if(kcExpected == tsi.GetValue)
+ rValue = 100;
+ Console.WriteLine("Test Expected {0}, but found {1}", kcExpected, tsi.GetValue);
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+}
+
+public class ThreadSafe
+{
+ ManualResetEvent signal;
+ public KrisClass Val = new KrisClass("hello world! ");
+ private int numberOfIterations;
+ public ThreadSafe(): this(100) { }
+ public ThreadSafe(int loops)
+ {
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorker(Object objIn)
+ {
+ KrisClass kcIn = (KrisClass)objIn;
+ signal.WaitOne();
+ for(int i=0;i<numberOfIterations;i++)
+ AddToTotal(kcIn);
+ }
+
+ private KrisClass AddToTotal(KrisClass addend)
+ {
+ KrisClass initialValue = new KrisClass(string.Empty);
+ KrisClass newValue = new KrisClass(string.Empty);
+ do
+ {
+ initialValue = Val;
+ newValue = initialValue + addend;
+ }
+ while (initialValue != Interlocked.CompareExchange<KrisClass>(
+ ref Val, newValue, initialValue));
+ return newValue;
+ }
+
+ public KrisClass GetValue
+ {
+ get
+ {
+ return Val;
+ }
+ }
+}
+
+public class KrisClass
+{
+ string retVal = string.Empty;
+ public KrisClass(string setVal)
+ {
+ retVal = setVal;
+ }
+
+ public string ClassVal
+ {
+ get
+ {
+ return retVal;
+ }
+ }
+
+ public static KrisClass operator +(KrisClass kc1, KrisClass kc2)
+ {
+ return new KrisClass(kc1.ClassVal + kc2.ClassVal);
+ }
+
+ public static bool operator ==(KrisClass kc1, KrisClass kc2)
+ {
+ if(kc1.ClassVal == kc2.ClassVal)
+ return true;
+ else
+ return false;
+ }
+
+ public static bool operator !=(KrisClass kc1, KrisClass kc2)
+ {
+ if(kc1.ClassVal != kc2.ClassVal)
+ return true;
+ else
+ return false;
+ }
+
+ public override bool Equals(object o)
+ {
+ try
+ {
+ return (bool) (this == (KrisClass) o);
+ }
+ catch
+ {
+ return false;
+ }
+ }
+
+ public override int GetHashCode()
+ {
+ return 0;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangetstring.cs b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangetstring.cs
new file mode 100644
index 0000000000..3eab2121fb
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/compareexchange/compareexchangetstring.cs
@@ -0,0 +1,104 @@
+// 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.Threading;
+
+class Class1
+{
+
+ static int Main(string[] args)
+ {
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe();
+
+ string strIn = args[0];
+
+ Console.WriteLine("Creating threads");
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i] = new Thread(new ParameterizedThreadStart(tsi.ThreadWorker));
+ threads[i].Start(strIn);
+ }
+
+ tsi.Signal();
+
+ Console.WriteLine("Joining threads");
+ for(int i=0;i<threads.Length;i++)
+ threads[i].Join();
+
+ // Build the expected string
+ string strExpected = string.Empty;
+ for(int i=0;i<threads.Length;i++)
+ strExpected += tsi.Expected;
+
+ if(tsi.Val == strExpected)
+ rValue = 100;
+
+ Console.WriteLine("Test Expected {0}, but found {1}", strExpected, tsi.Val);
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+}
+
+public class ThreadSafe
+{
+ ManualResetEvent signal;
+ public string Val = string.Empty;
+ private int numberOfIterations;
+ private string strIn = string.Empty;
+ public ThreadSafe(): this(100) { }
+ public ThreadSafe(int loops)
+ {
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorker(object obj)
+ {
+ strIn = obj.ToString();
+
+ if(0 < strIn.Length)
+ {
+ if("null" == strIn)
+ strIn = null;
+ else if("empty" == strIn)
+ strIn = string.Empty;
+ }
+
+ signal.WaitOne();
+ for(int i=0;i<numberOfIterations;i++)
+ AddToTotal(strIn);
+ }
+
+ public string Expected
+ {
+ get
+ {
+ string strTemp = string.Empty;
+ for(int i=0;i<numberOfIterations;i++)
+ strTemp += strIn;
+
+ return strTemp;
+ }
+ }
+
+ private string AddToTotal(string addend)
+ {
+ string initialValue, newValue;
+ do
+ {
+ initialValue = Val;
+ newValue = initialValue + addend;
+ }
+ while (initialValue != Interlocked.CompareExchange<string>(
+ ref Val, newValue, initialValue));
+ return newValue;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/ctorchk/ctorchk.cs b/tests/src/baseservices/threading/interlocked/ctorchk/ctorchk.cs
new file mode 100644
index 0000000000..6163bd50fe
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/ctorchk/ctorchk.cs
@@ -0,0 +1,30 @@
+// 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.Threading;
+using System.Reflection;
+
+class TestMonitor
+{
+ public static int Main()
+ {
+ // This will look for any private constructor.
+ // There shouldn't be one in Whidbey.
+ ConstructorInfo[] m = typeof(Interlocked).GetConstructors(
+ BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
+ Console.WriteLine(m.Length);
+
+ if(m.Length > 0)
+ {
+ Console.WriteLine("Test FAILED!");
+ return 1;
+ }
+ else
+ {
+ Console.WriteLine("Test PASSED!");
+ return 100;
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/ctorchk/ctorchk.csproj b/tests/src/baseservices/threading/interlocked/ctorchk/ctorchk.csproj
new file mode 100644
index 0000000000..dd246958b3
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/ctorchk/ctorchk.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CtorChk.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/decrement/intdec.cs b/tests/src/baseservices/threading/interlocked/decrement/intdec.cs
new file mode 100644
index 0000000000..c3b31073f3
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/decrement/intdec.cs
@@ -0,0 +1,32 @@
+// 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.Threading;
+
+namespace InterlockedTest
+{
+ class InterlockTest
+ {
+
+ public static int Main(string[] Args)
+ {
+ int rValue;
+ int loops = 5000;
+ int threads = 50;
+ if (Args.Length == 2)
+ {
+ loops = Int32.Parse(Args[0]);
+ threads = Int32.Parse(Args[1]);
+ }
+ Console.WriteLine("Starting Interlocked test on {0} threads for {1} iterations.",threads,loops);
+
+ IntTest testInt = new IntTest(loops, threads);
+
+ Console.WriteLine("Check Decrement: {0}", rValue = testInt.Dec());
+ Console.WriteLine("Test {0}", 100 == rValue ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/decrement/intdec.csproj b/tests/src/baseservices/threading/interlocked/decrement/intdec.csproj
new file mode 100644
index 0000000000..44b96732f4
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/decrement/intdec.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="..\common\InterlockedHelper_CoreCLR.cs" />
+ <Compile Include="IntDec.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/decrement/longdec.cs b/tests/src/baseservices/threading/interlocked/decrement/longdec.cs
new file mode 100644
index 0000000000..74045ee951
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/decrement/longdec.cs
@@ -0,0 +1,31 @@
+// 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.Threading;
+
+namespace InterlockedTest
+{
+ class InterlockTest
+ {
+ public static int Main(string[] Args)
+ {
+ int rValue;
+ int loops = 5000;
+ int threads = 50;
+ if (Args.Length == 2)
+ {
+ loops = Int32.Parse(Args[0]);
+ threads = Int32.Parse(Args[1]);
+ }
+ Console.WriteLine("Starting Interlocked test on {0} threads for {1} iterations.",threads,loops);
+
+ LongTest testLong = new LongTest(loops, threads);
+
+ Console.WriteLine("Check Decrement: {0}", rValue = testLong.Dec());
+ Console.WriteLine("Test {0}", 100 == rValue ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/decrement/longdec.csproj b/tests/src/baseservices/threading/interlocked/decrement/longdec.csproj
new file mode 100644
index 0000000000..a782730b33
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/decrement/longdec.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="..\common\InterlockedHelper_CoreCLR.cs" />
+ <Compile Include="LongDec.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/ExchangeInt.csproj b/tests/src/baseservices/threading/interlocked/exchange/ExchangeInt.csproj
new file mode 100644
index 0000000000..b6c64d2f0a
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/ExchangeInt.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="exchangeint.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/ExchangeLong.csproj b/tests/src/baseservices/threading/interlocked/exchange/ExchangeLong.csproj
new file mode 100644
index 0000000000..a80019a996
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/ExchangeLong.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="exchangelong.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/ExchangeTClass.csproj b/tests/src/baseservices/threading/interlocked/exchange/ExchangeTClass.csproj
new file mode 100644
index 0000000000..b1ec2cbb86
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/ExchangeTClass.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="exchangetclass.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/ExchangeTString.csproj b/tests/src/baseservices/threading/interlocked/exchange/ExchangeTString.csproj
new file mode 100644
index 0000000000..fbd958fe1e
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/ExchangeTString.csproj
@@ -0,0 +1,43 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="exchangetstring.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/interlocked/exchange/ExchangeTString_1.csproj b/tests/src/baseservices/threading/interlocked/exchange/ExchangeTString_1.csproj
new file mode 100644
index 0000000000..6b680177c3
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/ExchangeTString_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ExchangeTString.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>empty "This is a long string that I am trying to test to be sure that the Exchange can handle this long of a string. If it can not then that is bad and we will have to fix it."</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/interlocked/exchange/ExchangeTString_2.csproj b/tests/src/baseservices/threading/interlocked/exchange/ExchangeTString_2.csproj
new file mode 100644
index 0000000000..36817a41b1
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/ExchangeTString_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ExchangeTString.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>null "This is a string"</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchange1_cti.cs b/tests/src/baseservices/threading/interlocked/exchange/exchange1_cti.cs
new file mode 100644
index 0000000000..fb682e093b
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchange1_cti.cs
@@ -0,0 +1,165 @@
+// 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.Collections;
+using System.Threading;
+
+/// <summary>
+/// System.Threading.Interlocked.Exchange(System.Double@,System.Double)
+/// </summary>
+
+
+// This test makes sure that Exchange(Double, Double)
+// plays nicely with other threads accessing shared state directly.
+// The test spawns a bunch of threads, then each thread tries to
+// grab the mutex (set location=1), decrement a global resource count,
+// then release the mutex (set location=0). While location=0, the
+// thread will be able to set it to 1 and enter the mutex to consume
+// the resource, but if it is 1, the thread will be denied entry.
+// At the end, the test checks that:
+// the sum of all entries + denials = total potential resources
+// total potential resources = resources unconsumed + entries
+public class InterlockedExchange1
+{
+ private const int c_THREADARRAT_SIZE = 10; // how many threads to spawn
+ private const int c_WAITTHREADSCOMPLETE = 3000; // how long main thread should sleep
+ private static int resource = 10; // resources to be consumed
+ private static double location = 0; // mutex being managed thru Exchange
+ private static int entry = 0; // threads granted entry to the mutex
+ private static int deny = 0; // threads denied entry to the mutex
+
+ public static int Main(string[] args)
+ {
+ InterlockedExchange1 exchange1 = new InterlockedExchange1();
+ TestLibrary.TestFramework.BeginTestCase("Testing System.Threading.Interlocked.Exchange(System.Double@,System.Double)...");
+
+ if (exchange1.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+
+ return retVal;
+ }
+
+ public bool PosTest1()
+ {
+ bool retVal = true;
+ TestLibrary.TestFramework.BeginScenario("PosTest1: Verify multiple threads share the same resource by using Interlocked.Exchange method...");
+
+ try
+ {
+ // create an array of many threads
+ Thread[] threads = new Thread[c_THREADARRAT_SIZE];
+ Random rand = new Random();
+
+ // for each thread
+ for (int i = 0; i < threads.Length; i++)
+ {
+ // each thread uses ConsumeResource
+ threads[i] = new Thread(new ThreadStart(ConsumeResource));
+ // and has a name
+ threads[i].Name = String.Format("Thread{0}",i+1);
+ // put the spawning thread to sleep for a random period of time
+ Thread.Sleep(rand.Next(1,100));
+ // then start the spawned thread working
+ threads[i].Start();
+ }
+
+ // after all threads are spawned, put the spawining thread
+ // to sleep for long enough that the spawned threads have
+ // time to complete
+ Thread.Sleep(c_WAITTHREADSCOMPLETE);
+
+ // entries + denials should equal original value of resource (10)
+ if (entry + deny == 10)
+ {
+ // if any resources remain unconsumed, then those plus number
+ // of successful entries should equal the original value of
+ // resource (10)
+ if (resource > 0 && resource + entry != 10)
+ {
+ TestLibrary.TestFramework.LogError("001","The number of resources consumed is wrong!");
+ retVal = false;
+ }
+ }
+ else
+ {
+ TestLibrary.TestFramework.LogError("002","The total number is wrong!");
+ retVal = false;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("003","Unexpected exception occurs: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+ private static void ConsumeResource()
+ {
+ // This is effectively a hand-coded mutex.
+ // The thread exchanges the value 1 with the value
+ // already at location (initially 0). So first time, it should
+ // set location=1 and return 0. When it gets back the 0, it knows
+ // it holds the mutex. So the thread 'consumes' a
+ // resource and records an 'entry', after which it sets location
+ // back to 0, effectively releasing the mutex.
+ // Any thread hitting the first Exchange while location=1 will
+ // be returned the 1, and thus not enter the mutex - it will
+ // just record a 'denial' and not 'consume' a resource.
+ // After all is said and done, denials+entries should equal total
+ // initial resources.
+
+ // obtain the mutex by putting a 1 there and getting back a 0)
+ if (Interlocked.Exchange(ref location, 1) == 0) // corrected, was !=0
+ {
+ // this thread has the mutex
+ if (resource > 0)
+ {
+ // consume a resource
+ resource--;
+ TestLibrary.TestFramework.LogInformation(String.Format("The resource is reduced, the remainder is {0}",resource));
+ }
+ else
+ {
+ // no more resources to consume - this really should never happen
+ TestLibrary.TestFramework.LogInformation("The resource is empty!");
+ }
+
+ // release the mutex (put a 0 back in location)
+ Interlocked.Exchange(ref location,0);
+ // increment the entry count -
+ Interlocked.Increment(ref entry); // corrected, was entry++;
+ // which is not thread safe;
+ }
+ else
+ {
+ // the thread could not enter the mutex because another
+ // thread has set the location to 1
+ TestLibrary.TestFramework.LogInformation("This is not available!");
+ // increment the denial count, no resource is consumed
+ Interlocked.Increment(ref deny); // corrected, was deny++;
+ // which is not thread safe;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchange1_cti.csproj b/tests/src/baseservices/threading/interlocked/exchange/exchange1_cti.csproj
new file mode 100644
index 0000000000..77988823c5
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchange1_cti.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="Exchange1_cti.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchange2.cs b/tests/src/baseservices/threading/interlocked/exchange/exchange2.cs
new file mode 100644
index 0000000000..a4ba8ff836
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchange2.cs
@@ -0,0 +1,150 @@
+// 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.Threading;
+
+// Tests that Exchange(object, object) works on variety
+// of casted types: It just casts a bunch of different types to
+// object, then makes sure Exchange works on those objects.
+public class InterlockedExchange2
+{
+ private const int c_NUM_LOOPS = 100;
+ private const int c_MIN_STRING_LEN = 5;
+ private const int c_MAX_STRING_LEN = 128;
+
+ public static int Main()
+ {
+ InterlockedExchange2 test = new InterlockedExchange2();
+
+ TestLibrary.TestFramework.BeginTestCase("InterlockedExchange2");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+
+ return retVal;
+ }
+
+ public bool PosTest1()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object Interlocked.Exchange(objct&,object)");
+
+ try
+ {
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == Byte");
+ retVal = ExchangeObjects(
+ (object)TestLibrary.Generator.GetByte(),
+ (object)TestLibrary.Generator.GetByte()
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == Byte[]");
+ byte[] bArr1 = new Byte[5 + (TestLibrary.Generator.GetInt32() % 1024)];
+ byte[] bArr2 = new Byte[5 + (TestLibrary.Generator.GetInt32() % 1024)];
+ TestLibrary.Generator.GetBytes(bArr1);
+ TestLibrary.Generator.GetBytes(bArr2);
+ retVal = ExchangeObjects(
+ (object)bArr1,
+ (object)bArr2
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == Int16");
+ retVal = ExchangeObjects(
+ (object)TestLibrary.Generator.GetInt16(),
+ (object)TestLibrary.Generator.GetInt16()
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == Int32");
+ retVal = ExchangeObjects(
+ (object)TestLibrary.Generator.GetInt32(),
+ (object)TestLibrary.Generator.GetInt32()
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == Int64");
+ retVal = ExchangeObjects(
+ (object)(object)TestLibrary.Generator.GetInt64(),
+ (object)TestLibrary.Generator.GetInt64()
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == Single");
+ retVal = ExchangeObjects(
+ (object)(object)TestLibrary.Generator.GetSingle(),
+ (object)TestLibrary.Generator.GetSingle()
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == Double");
+ retVal = ExchangeObjects(
+ (object)TestLibrary.Generator.GetDouble(),
+ (object)TestLibrary.Generator.GetDouble()
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == string");
+ retVal = ExchangeObjects(
+ TestLibrary.Generator.GetString(false, c_MIN_STRING_LEN, c_MAX_STRING_LEN),
+ (object)TestLibrary.Generator.GetString(false, c_MIN_STRING_LEN, c_MAX_STRING_LEN)
+ ) && retVal;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: object == char");
+ retVal = ExchangeObjects(
+ TestLibrary.Generator.GetChar(),
+ TestLibrary.Generator.GetChar()
+ ) && retVal;
+
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+ public bool ExchangeObjects(object location, object value)
+ {
+ bool retVal = true;
+ object oldLocation;
+ object prevLocation;
+
+ prevLocation = location;
+
+ // this is the main change from InterlockedExchange2.cs
+ // here we use the object overload
+ oldLocation = Interlocked.Exchange(ref location, value);
+
+ if (!location.Equals(value))
+ {
+ TestLibrary.TestFramework.LogError("003", "Interlocked.Exchange() did not do the exchange correctly: Expected(" + value + ") Actual(" + location + ")");
+ retVal = false;
+ }
+
+ if (!oldLocation.Equals(prevLocation))
+ {
+ TestLibrary.TestFramework.LogError("004", "Interlocked.Exchange() did not return the expected value: Expected(" + prevLocation + ") Actual(" + oldLocation + ")");
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+}
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchange2.csproj b/tests/src/baseservices/threading/interlocked/exchange/exchange2.csproj
new file mode 100644
index 0000000000..11cba3d90c
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchange2.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="Exchange2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchange3.cs b/tests/src/baseservices/threading/interlocked/exchange/exchange3.cs
new file mode 100644
index 0000000000..ed5ea017f3
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchange3.cs
@@ -0,0 +1,86 @@
+// 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.Threading;
+
+// Tests that Exchange(Double, Double)
+// actually switches values
+public class InterlockedExchange3
+{
+ private const int c_NUM_LOOPS = 100;
+
+ public static int Main()
+ {
+ InterlockedExchange3 test = new InterlockedExchange3();
+
+ TestLibrary.TestFramework.BeginTestCase("InterlockedExchange3");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+
+ return retVal;
+ }
+
+ public bool PosTest1()
+ {
+ bool retVal = true;
+ Double location;
+ Double value;
+ Double prevLocation;
+ Double oldLocation;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: Double Interlocked.Exchange(Double&,Double)");
+
+ try
+ {
+ for (int i=0; i<c_NUM_LOOPS; i++)
+ {
+ value = TestLibrary.Generator.GetDouble();
+ location = TestLibrary.Generator.GetDouble();
+ prevLocation = location;
+
+ oldLocation = Interlocked.Exchange(ref location, value);
+
+ if (!location.Equals(value))
+ {
+ TestLibrary.TestFramework.LogError("001", "Interlocked.Exchange() did not do the exchange correctly: Expected(" + value + ") Actual(" + location + ")");
+ retVal = false;
+ }
+
+ if (!oldLocation.Equals(prevLocation))
+ {
+ TestLibrary.TestFramework.LogError("002", "Interlocked.Exchange() did not return the expected value: Expected(" + prevLocation + ") Actual(" + oldLocation + ")");
+ retVal = false;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("003", "Unexpected exception: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+}
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchange3.csproj b/tests/src/baseservices/threading/interlocked/exchange/exchange3.csproj
new file mode 100644
index 0000000000..1f4e169fbb
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchange3.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="Exchange3.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchange4.cs b/tests/src/baseservices/threading/interlocked/exchange/exchange4.cs
new file mode 100644
index 0000000000..85cc51dc09
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchange4.cs
@@ -0,0 +1,86 @@
+// 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.Threading;
+
+// Tests that Exchange(Single, Single)
+// a.k.a., CompareExchange(float, float)
+// actually switches values
+public class InterlockedExchange4
+{
+ private const int c_NUM_LOOPS = 100;
+
+ public static int Main()
+ {
+ InterlockedExchange4 test = new InterlockedExchange4();
+
+ TestLibrary.TestFramework.BeginTestCase("InterlockedExchange4");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+
+ return retVal;
+ }
+
+ public bool PosTest1()
+ {
+ bool retVal = true;
+ Single location;
+ Single value;
+ Single prevLocation;
+ Single oldLocation;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: Single Interlocked.Exchange(Single&,Single)");
+
+ try
+ {
+ for (int i=0; i<c_NUM_LOOPS; i++)
+ {
+ value = TestLibrary.Generator.GetSingle();
+ location = TestLibrary.Generator.GetSingle();
+ prevLocation = location;
+
+ oldLocation = Interlocked.Exchange(ref location, value);
+
+ if (!location.Equals(value))
+ {
+ TestLibrary.TestFramework.LogError("001", "Interlocked.Exchange() did not do the exchange correctly: Expected(" + value + ") Actual(" + location + ")");
+ retVal = false;
+ }
+
+ if (!oldLocation.Equals(prevLocation))
+ {
+ TestLibrary.TestFramework.LogError("002", "Interlocked.Exchange() did not return the expected value: Expected(" + prevLocation + ") Actual(" + oldLocation + ")");
+ retVal = false;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("003", "Unexpected exception: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchange4.csproj b/tests/src/baseservices/threading/interlocked/exchange/exchange4.csproj
new file mode 100644
index 0000000000..0282d265e2
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchange4.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="Exchange4.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchange4_cti.cs b/tests/src/baseservices/threading/interlocked/exchange/exchange4_cti.cs
new file mode 100644
index 0000000000..ba38b07ad2
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchange4_cti.cs
@@ -0,0 +1,165 @@
+// 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.Collections;
+using System.Threading;
+
+/// <summary>
+/// System.Threading.Interlocked.Exchange(System.Single@,System.Single)
+/// </summary>
+
+
+// This test makes sure that Exchange(Single, Single)
+// plays nicely with other threads accessing shared state directly.
+// The test spawns a bunch of threads, then each thread tries to
+// grab the mutex (set location=1), decrement a global resource count,
+// then release the mutex (set location=0). While location=0, the
+// thread will be able to set it to 1 and enter the mutex to consume
+// the resource, but if it is 1, the thread will be denied entry.
+// At the end, the test checks that:
+// the sum of all entries + denials = total potential resources
+// total potential resources = resources unconsumed + entries
+public class InterlockedExchange4
+{
+ private const int c_THREADARRAT_SIZE = 10; // how many threads to spawn
+ private const int c_WAITTHREADSCOMPLETE = 2000; // how long main thread should sleep
+ private static int resource = 10; // resources to be consumed
+ private static Int64 location = 0; // mutex being managed thru Exchange
+ private static int entry = 0; // threads granted entry to the mutex
+ private static int deny = 0; // threads denied entry to the mutex
+
+ public static int Main(string[] args)
+ {
+ InterlockedExchange4 exchange4 = new InterlockedExchange4();
+ TestLibrary.TestFramework.BeginTestCase("Testing System.Threading.Interlocked.Exchange(System.Single@,System.Single)...");
+
+ if (exchange4.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+
+ return retVal;
+ }
+
+ public bool PosTest1()
+ {
+ bool retVal = true;
+ TestLibrary.TestFramework.BeginScenario("PosTest1: Verify multiple threads share the same resource by using Interlocked.Exchange method...");
+
+ try
+ {
+ // create an array of many threads
+ Thread[] threads = new Thread[c_THREADARRAT_SIZE];
+ Random rand = new Random();
+
+ // for each thread
+ for (int i = 0; i < threads.Length; i++)
+ {
+ // each thread uses ConsumeResource
+ threads[i] = new Thread(new ThreadStart(ConsumeResource));
+ // and has a name
+ threads[i].Name = String.Format("Thread{0}", i + 1);
+ // put the spawning thread to sleep for a random period of time
+ Thread.Sleep(rand.Next(1, 100));
+ // then start the spawned thread working
+ threads[i].Start();
+ }
+
+ // after all threads are spawned, put the spawining thread
+ // to sleep for long enough that the spawned threads have
+ // time to complete
+ Thread.Sleep(c_WAITTHREADSCOMPLETE);
+
+ // entries + denials should equal original value of resource (10)
+ if (entry + deny == 10)
+ {
+ // if any resources remain unconsumed, then those plus number
+ // of successful entries should equal the original value of
+ // resource (10)
+ if (resource > 0 && resource + entry != 10)
+ {
+ TestLibrary.TestFramework.LogError("001", "The number of resource is consumed is wrong!");
+ retVal = false;
+ }
+ }
+ else
+ {
+ TestLibrary.TestFramework.LogError("002", "The total number is wrong!");
+ retVal = false;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("003", "Unexpected exception occurs: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+ private static void ConsumeResource()
+ {
+ // This is effectively a hand-coded mutex.
+ // The thread exchanges the value 1 with the value
+ // already at location (initially 0). So first time, it should
+ // set location=1 and return 0. When it gets back the 0, it knows
+ // it holds the mutex. So the thread 'consumes' a
+ // resource and records an 'entry', after which it sets location
+ // back to 0, effectively releasing the mutex.
+ // Any thread hitting the first Exchange while location=1 will
+ // be returned the 1, and thus not enter the mutex - it will
+ // just record a 'denial' and not 'consume' a resource.
+ // After all is said and done, denials+entries should equal total
+ // original resources.
+
+ // obtain the mutex by putting a 1 there and getting back a 0)
+ if (Interlocked.Exchange(ref location, 1) == 0) // corrected, was !=0
+ {
+ // this thread has the mutex
+ if (resource > 0)
+ {
+ // consume a resource
+ resource--;
+ TestLibrary.TestFramework.LogInformation(String.Format("The resource is reduced,the rest number is {0}", resource));
+ }
+ else
+ {
+ // no more resources to consume - this really should never happen
+ TestLibrary.TestFramework.LogInformation("The resource is empty!");
+ }
+
+ // release the mutex (put a 0 back in location)
+ Interlocked.Exchange(ref location, 0);
+ // increment the entry count -
+ Interlocked.Increment(ref entry); // corrected, was entry++;
+ // which is not thread safe;
+ }
+ else
+ {
+ // the thread could not enter the mutex because another
+ // thread has set the location to 1
+ TestLibrary.TestFramework.LogInformation("This is not available!");
+ // increment the denial count, no resource is consumed
+ Interlocked.Increment(ref deny); // corrected, was deny++;
+ // which is not thread safe;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchange4_cti.csproj b/tests/src/baseservices/threading/interlocked/exchange/exchange4_cti.csproj
new file mode 100644
index 0000000000..a8cd9082c6
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchange4_cti.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="Exchange4_cti.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchange5_cti.cs b/tests/src/baseservices/threading/interlocked/exchange/exchange5_cti.cs
new file mode 100644
index 0000000000..af0da2a532
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchange5_cti.cs
@@ -0,0 +1,165 @@
+// 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.Collections;
+using System.Threading;
+
+/// <summary>
+/// System.Threading.Interlocked.Exchange(System.Object@,System.Object)
+/// </summary>
+
+
+// This test makes sure that Exchange(object, object)
+// plays nicely with other threads accessing shared state directly.
+// The test spawns a bunch of threads, then each thread tries to
+// grab the mutex (set location=1), decrement a global resource count,
+// then release the mutex (set location=0). While location=0, the
+// thread will be able to set it to 1 and enter the mutex to consume
+// the resource, but if it is 1, the thread will be denied entry.
+// At the end, the test checks that:
+// the sum of all entries + denials = total potential resources
+// total potential resources = resources unconsumed + entries
+public class InterlockedExchange5
+{
+ private const int c_THREADARRAT_SIZE = 10; // how many threads to spawn
+ private const int c_WAITTHREADSCOMPLETE = 2000; // how long main thread should sleep
+ private static int resource = 10; // resources to be consumed
+ private static Object location = 0; // mutex being managed thru Exchange
+ private static int entry = 0; // threads granted entry to the mutex
+ private static int deny = 0; // threads denied entry to the mutex
+
+ public static int Main(string[] args)
+ {
+ InterlockedExchange5 exchange5 = new InterlockedExchange5();
+ TestLibrary.TestFramework.BeginTestCase("Testing System.Threading.Interlocked.Exchange(System.Object@,System.Object)...");
+
+ if (exchange5.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+
+ return retVal;
+ }
+
+ public bool PosTest1()
+ {
+ bool retVal = true;
+ TestLibrary.TestFramework.BeginScenario("PosTest1: Verify multiple threads share the same resource by using Interlocked.Exchange method...");
+
+ try
+ {
+ // create an array of many threads
+ Thread[] threads = new Thread[c_THREADARRAT_SIZE];
+ Random rand = new Random();
+
+ // for each thread
+ for (int i = 0; i < threads.Length; i++)
+ {
+ // each thread uses ConsumeResource
+ threads[i] = new Thread(new ThreadStart(ConsumeResource));
+ // and has a name
+ threads[i].Name = String.Format("Thread{0}", i + 1);
+ // put this (the spawning) thread to sleep for a random period of time
+ Thread.Sleep(rand.Next(1, 100));
+ // then start the spawned thread working
+ threads[i].Start();
+ }
+
+ // after all threads are spawned, put the spawining thread
+ // to sleep for long enough that the spawned threads have
+ // time to complete
+ Thread.Sleep(c_WAITTHREADSCOMPLETE);
+
+ // entries + denials should equal original value of resource (10)
+ if (entry + deny == 10)
+ {
+ // if any resources remain unconsumed, then those plus number
+ // of successful entries should equal the original value of
+ // resource (10)
+ if (resource > 0 && resource + entry != 10)
+ {
+ TestLibrary.TestFramework.LogError("001", "The number of resource is consumed is wrong!");
+ retVal = false;
+ }
+ }
+ else
+ {
+ TestLibrary.TestFramework.LogError("002", "The total number is wrong!");
+ retVal = false;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("003", "Unexpected exception occurs: " + e);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+
+ private static void ConsumeResource()
+ {
+ // This is effectively a hand-coded mutex.
+ // The thread exchanges the value 1 with the value
+ // already at location (initially 0). So first time, it should
+ // set location=1 and return 0. Then the thread 'consumes' a
+ // resource and records an 'entry', after which it sets location
+ // back to 0. Any thread hitting the Exchange while loc=1 will see
+ // this and not enter the mutex - it will just record a 'denial'.
+ // After all is said and done, denials+entries should equal total
+ // resources consumed.
+ // note that since location is actually an object, Exchange is going
+ // to return an object which must be converted to Int32
+ // note that here we use the object overload of Interlocked.Exchange
+ if (Convert.ToInt32(Interlocked.Exchange(ref location, 1)) == 0) // corrected, was !=0
+ {
+ // this thread has the mutex
+ if (resource > 0)
+ {
+ // consume a resource
+ resource--;
+ TestLibrary.TestFramework.LogInformation(String.Format("The resource is reduced, the remainder is {0}", resource));
+ }
+ else
+ {
+ // no more resources to consume - this really should never happen
+ TestLibrary.TestFramework.LogInformation("The resource is empty!");
+ }
+
+ // release the mutex
+ // note that here we use the object overload
+ // of Exchange
+ Interlocked.Exchange(ref location, 0);
+ // increment the entry count -
+ Interlocked.Increment(ref entry); // corrected, was entry++;
+ // which is not thread safe
+ }
+ else
+ {
+ // the thread could not enter the mutex because another
+ // thread has set the location to 1
+ TestLibrary.TestFramework.LogInformation("This is not available!");
+ // increment the denial count, no resource is consumed
+ Interlocked.Increment(ref deny); // corrected, was deny++;
+ // which is not thread safe
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchange5_cti.csproj b/tests/src/baseservices/threading/interlocked/exchange/exchange5_cti.csproj
new file mode 100644
index 0000000000..35ca50ef72
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchange5_cti.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="Exchange5_cti.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchangedouble.cs b/tests/src/baseservices/threading/interlocked/exchange/exchangedouble.cs
new file mode 100644
index 0000000000..385f549eb3
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchangedouble.cs
@@ -0,0 +1,99 @@
+// 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.Threading;
+
+namespace Exchange
+{
+ class ExchangeDouble
+ {
+ static int Main(string[] args)
+ {
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe();
+ for (int i = 0; i < threads.Length - 1; i++)
+ {
+ if (i % 2 == 0)
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorkerA));
+ else
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorkerB));
+ threads[i].Start();
+ }
+ threads[threads.Length - 1] = new Thread(new ThreadStart(tsi.ThreadChecker));
+ threads[threads.Length - 1].Start();
+ tsi.Signal();
+
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+
+ if (tsi.Pass)
+ rValue = 100;
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ManualResetEvent signal;
+ private double totalValue = Double.MinValue;
+ private int numberOfIterations;
+ private double newValueA = 0.0D;
+ private double newValueB = Double.MinValue;
+ private bool success;
+ public ThreadSafe(): this(10000) { }
+ public ThreadSafe(int loops)
+ {
+ success = true;
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorkerA()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ Interlocked.Exchange(ref totalValue, newValueA);
+ }
+
+ public void ThreadWorkerB()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ Interlocked.Exchange(ref totalValue, newValueB);
+ }
+
+ public void ThreadChecker()
+ {
+ double tmpVal;
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ {
+ tmpVal = totalValue;
+ if (tmpVal != newValueB && tmpVal != newValueA)
+ {
+ Console.WriteLine(tmpVal + "," +
+ newValueB + "," + newValueA);
+ success = false;
+ }
+ Thread.Sleep(0);
+ }
+ }
+
+ public bool Pass
+ {
+ get
+ {
+ return (success);
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchangedouble.csproj b/tests/src/baseservices/threading/interlocked/exchange/exchangedouble.csproj
new file mode 100644
index 0000000000..b3cb56c6d3
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchangedouble.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ExchangeDouble.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchangefloat.cs b/tests/src/baseservices/threading/interlocked/exchange/exchangefloat.cs
new file mode 100644
index 0000000000..0811db9469
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchangefloat.cs
@@ -0,0 +1,107 @@
+// 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.Threading;
+
+namespace Exchange
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ class Class1
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static int Main(string[] args)
+ {
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe();
+ for (int i = 0; i < threads.Length - 1; i++)
+ {
+ if (i % 2 == 0)
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorkerA));
+ else
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorkerB));
+ threads[i].Start();
+ }
+ threads[threads.Length - 1] = new Thread(new ThreadStart(tsi.ThreadChecker));
+ threads[threads.Length - 1].Start();
+ tsi.Signal();
+
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+
+ if (tsi.Pass)
+ rValue = 100;
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ManualResetEvent signal;
+ private float totalValue = Single.MinValue;
+ private int numberOfIterations;
+ private float newValueA = 0.0F;
+ private float newValueB = Single.MinValue;
+ private bool success;
+ public ThreadSafe(): this(10000) { }
+ public ThreadSafe(int loops)
+ {
+ success = true;
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorkerA()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ Interlocked.Exchange(ref totalValue, newValueA);
+
+ }
+ public void ThreadWorkerB()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ Interlocked.Exchange(ref totalValue, newValueB);
+
+ }
+ public void ThreadChecker()
+ {
+ float tmpVal;
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ {
+ tmpVal = totalValue;
+ if (tmpVal != newValueB && tmpVal != newValueA)
+ {
+
+ Console.WriteLine(tmpVal + "," + newValueB + "," + newValueA);
+ success = false;
+ }
+ Thread.Sleep(0);
+ }
+
+ }
+
+ public bool Pass
+ {
+ get
+ {
+ return (success);
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchangefloat.csproj b/tests/src/baseservices/threading/interlocked/exchange/exchangefloat.csproj
new file mode 100644
index 0000000000..574ca1dcb8
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchangefloat.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ExchangeFloat.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchangeint.cs b/tests/src/baseservices/threading/interlocked/exchange/exchangeint.cs
new file mode 100644
index 0000000000..0c6fb76a8a
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchangeint.cs
@@ -0,0 +1,103 @@
+// 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.Threading;
+
+namespace Exchange
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ class Class1
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ static int Main(string[] args)
+ {
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe();
+ for (int i = 0; i < threads.Length - 1; i++)
+ {
+ if (i % 2 == 0)
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorkerA));
+ else
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorkerB));
+ threads[i].Start();
+ }
+ threads[threads.Length - 1] = new Thread(new ThreadStart(tsi.ThreadChecker));
+ threads[threads.Length - 1].Start();
+ tsi.Signal();
+
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+
+ if (tsi.Pass)
+ rValue = 100;
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ManualResetEvent signal;
+ private int totalValue = Int32.MinValue;
+ private int numberOfIterations;
+ private int newValueA = 0;
+ private int newValueB = Int32.MinValue;
+ private bool success;
+ public ThreadSafe(): this(10000) { }
+ public ThreadSafe(int loops)
+ {
+ success = true;
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorkerA()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ Interlocked.Exchange(ref totalValue, newValueA);
+
+ }
+ public void ThreadWorkerB()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ Interlocked.Exchange(ref totalValue, newValueB);
+
+ }
+ public void ThreadChecker()
+ {
+ signal.WaitOne();
+ int tmpVal;
+ for (int i = 0; i < numberOfIterations; i++)
+ {
+ tmpVal = totalValue;
+ if (tmpVal != newValueB && tmpVal != newValueA)
+ {
+ Console.WriteLine(tmpVal + "," + newValueB + "," + newValueA);
+ success = false;
+ }
+ Thread.Sleep(0);
+ }
+ }
+
+ public bool Pass
+ {
+ get
+ {
+ return (success);
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchangelong.cs b/tests/src/baseservices/threading/interlocked/exchange/exchangelong.cs
new file mode 100644
index 0000000000..f43435de7c
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchangelong.cs
@@ -0,0 +1,100 @@
+// 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.Threading;
+
+namespace Exchange
+{
+ class ExchangeLong
+ {
+ static int Main(string[] args)
+ {
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe();
+ for (int i = 0; i < threads.Length - 1; i++)
+ {
+ if (i % 2 == 0)
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorkerA));
+ else
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorkerB));
+ threads[i].Start();
+ }
+ threads[threads.Length - 1] = new Thread(new ThreadStart(tsi.ThreadChecker));
+ threads[threads.Length - 1].Start();
+ tsi.Signal();
+
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+
+ if (tsi.Pass)
+ rValue = 100;
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ManualResetEvent signal;
+ private long totalValue = Int64.MinValue;
+ private int numberOfIterations;
+ private long newValueA = 0;
+ private long newValueB = Int64.MinValue;
+ private bool success;
+ public ThreadSafe(): this(10000) { }
+ public ThreadSafe(int loops)
+ {
+ success = true;
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorkerA()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ Interlocked.Exchange(ref totalValue, newValueA);
+
+ }
+ public void ThreadWorkerB()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ Interlocked.Exchange(ref totalValue, newValueB);
+ }
+
+ public void ThreadChecker()
+ {
+ signal.WaitOne();
+ long tmpVal;
+ for (int i = 0; i < numberOfIterations; i++)
+ {
+ tmpVal = totalValue;
+ if (tmpVal != newValueB && tmpVal != newValueA)
+ {
+
+ Console.WriteLine(tmpVal + "," +
+ newValueB + "," + newValueA);
+ success = false;
+ }
+ Thread.Sleep(0);
+ }
+
+ }
+
+ public bool Pass
+ {
+ get
+ {
+ return (success);
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchangeobject.cs b/tests/src/baseservices/threading/interlocked/exchange/exchangeobject.cs
new file mode 100644
index 0000000000..09fa32a46f
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchangeobject.cs
@@ -0,0 +1,107 @@
+// 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.Threading;
+
+namespace InteropTests
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ class ExchangeObject
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static int Main(string[] args)
+ {
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe();
+ for (int i = 0; i < threads.Length - 1; i++)
+ {
+ if (i % 2 == 0)
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorkerA));
+ else
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorkerB));
+ threads[i].Start();
+ }
+ threads[threads.Length - 1] = new Thread(new ThreadStart(tsi.ThreadChecker));
+ threads[threads.Length - 1].Start();
+ tsi.Signal();
+
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+
+ if (tsi.Pass)
+ rValue = 100;
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ManualResetEvent signal;
+ private Object totalValue = null;
+ private int numberOfIterations;
+ private Object newValueA = new Object();
+ private Object newValueB = new Object();
+ private bool success;
+ public ThreadSafe(): this(10000) { }
+ public ThreadSafe(int loops)
+ {
+ totalValue = newValueA;
+ success = true;
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorkerA()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ Interlocked.Exchange(ref totalValue, newValueB);
+
+ }
+ public void ThreadWorkerB()
+ {
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ Interlocked.Exchange(ref totalValue, newValueB);
+
+ }
+ public void ThreadChecker()
+ {
+ signal.WaitOne();
+ Object tmpVal;
+ for (int i = 0; i < numberOfIterations; i++)
+ {
+ tmpVal = totalValue;
+ if (tmpVal != newValueB && tmpVal != newValueA)
+ {
+ Console.WriteLine(tmpVal + "," + newValueB + "," + newValueA);
+ success = false;
+ }
+ Thread.Sleep(0);
+ }
+
+ }
+
+ public bool Pass
+ {
+ get
+ {
+ return (success);
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchangeobject.csproj b/tests/src/baseservices/threading/interlocked/exchange/exchangeobject.csproj
new file mode 100644
index 0000000000..b4b0f5add2
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchangeobject.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ExchangeObject.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchanget.cs b/tests/src/baseservices/threading/interlocked/exchange/exchanget.cs
new file mode 100644
index 0000000000..6e54966049
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchanget.cs
@@ -0,0 +1,42 @@
+// 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.Threading;
+
+public class Test
+{
+
+ public static int Main()
+ {
+ Console.WriteLine("Start");
+ int retVal = 100;
+ string STORAGE = "OLD";
+ string NOW = "NOW";
+ string ret = "";
+
+ Console.WriteLine("ref loc: " + STORAGE);
+ Console.WriteLine("Return: " + ret);
+
+ Console.WriteLine("Echanging in:" + NOW);
+
+ string OLDSTORAGE = STORAGE;
+ ret = Interlocked.Exchange<string>(ref STORAGE,NOW);
+
+ Console.WriteLine("ref loc: " + STORAGE);
+ Console.WriteLine("Return: " + ret);
+
+ //if(ret == "" || STORAGE != NOW)
+ if(ret != OLDSTORAGE || STORAGE != NOW)
+ retVal = -1;
+
+ if (retVal == 100)
+ Console.WriteLine("Test passed");
+ else
+ Console.WriteLine("Test failed");
+
+ return retVal;
+
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchanget.csproj b/tests/src/baseservices/threading/interlocked/exchange/exchanget.csproj
new file mode 100644
index 0000000000..94e98d2bc2
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchanget.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ExchangeT.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchangetclass.cs b/tests/src/baseservices/threading/interlocked/exchange/exchangetclass.cs
new file mode 100644
index 0000000000..a6cb79080e
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchangetclass.cs
@@ -0,0 +1,145 @@
+// 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.Threading;
+
+class ExchangeClass
+{
+ static int Main(string[] args)
+ {
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe();
+ Console.WriteLine("Creating Threads");
+ for (int i = 0; i < threads.Length - 1; i++)
+ {
+ if (i % 2 == 0)
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorkerA));
+ else
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorkerB));
+ threads[i].Start();
+ }
+
+ Console.WriteLine("Starting checker");
+ threads[threads.Length - 1] = new Thread(new ThreadStart(tsi.ThreadChecker));
+ threads[threads.Length - 1].Start();
+ tsi.Signal();
+
+ Console.WriteLine("Joining Threads");
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+
+ if (tsi.Pass)
+ rValue = 100;
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+}
+
+public class ThreadSafe
+{
+ ManualResetEvent signal;
+ private KrisClass totalValue = new KrisClass(1);
+ private int numberOfIterations;
+ private KrisClass newValueA = new KrisClass(12345);
+ private KrisClass newValueB = new KrisClass(67890);
+ private bool success;
+ public ThreadSafe(): this(10000) { }
+ public ThreadSafe(int loops)
+ {
+ success = true;
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorkerA()
+ {
+ KrisClass ret = null;
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ {
+ ret = Interlocked.Exchange<KrisClass>(ref totalValue, newValueA);
+
+ // Check return value
+ if (ret.ClassVal != newValueA.ClassVal &&
+ ret.ClassVal != newValueB.ClassVal &&
+ ret.ClassVal != 1)
+ {
+ Console.WriteLine(ret.ClassVal + "," +
+ newValueB.ClassVal + "," + newValueA.ClassVal);
+ success = false;
+ }
+ }
+
+ }
+
+ public void ThreadWorkerB()
+ {
+ KrisClass ret = null;
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ {
+ ret = Interlocked.Exchange<KrisClass>(ref totalValue, newValueB);
+
+ // Check return value
+ if (ret.ClassVal != newValueA.ClassVal &&
+ ret.ClassVal != newValueB.ClassVal &&
+ ret.ClassVal != 1)
+ {
+ Console.WriteLine(ret.ClassVal + "," +
+ newValueB.ClassVal + "," + newValueA.ClassVal);
+ success = false;
+ }
+ }
+ }
+
+ public void ThreadChecker()
+ {
+ signal.WaitOne();
+ KrisClass tmpVal;
+ for (int i = 0; i < numberOfIterations; i++)
+ {
+ tmpVal = totalValue;
+ if (tmpVal.ClassVal != newValueB.ClassVal &&
+ tmpVal.ClassVal != newValueA.ClassVal &&
+ tmpVal.ClassVal != 1)
+ {
+ Console.WriteLine(tmpVal.ClassVal + "," + newValueB.ClassVal + "," +
+ newValueA.ClassVal);
+ success = false;
+ }
+ Thread.Sleep(0);
+ }
+ }
+
+ public bool Pass
+ {
+ get
+ {
+ return (success);
+ }
+ }
+}
+
+public class KrisClass
+{
+ int retVal = 0;
+ public KrisClass(int setVal)
+ {
+ retVal = setVal;
+ }
+
+ public int ClassVal
+ {
+ get
+ {
+ return retVal;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchangetneg.il b/tests/src/baseservices/threading/interlocked/exchange/exchangetneg.il
new file mode 100644
index 0000000000..ee0e5b6b04
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchangetneg.il
@@ -0,0 +1,115 @@
+//
+// This .il file was created by ildasming ExchangeTNegSource.exe
+// then changing
+// IL_000d: ldnull
+// IL_000e: stloc.1
+// IL_000f: ldloca.s V_1
+// IL_0011: ldstr "hello world"
+// to
+// IL_000d: ldloc.s 1
+// IL_0011: ldstr "hello world"
+
+.assembly extern mscorlib
+{
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
+ .ver 2:0:0:0
+}
+.assembly ExchangeTNeg {}
+
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig static int32 Main() cil managed
+ {
+ .entrypoint
+ .custom instance void [mscorlib]System.Security.SecuritySafeCriticalAttribute::.ctor() = ( 01 00 00 00 )
+ // Code size 100 (0x64)
+ .maxstack 2
+ .locals init (int32 V_0,
+ object V_1,
+ object V_2,
+ class [mscorlib]System.Exception V_3,
+ int32 V_4,
+//Next line was added
+ object& V_5)
+ IL_0000: nop
+ IL_0001: ldc.i4.m1
+ IL_0002: stloc.0
+ IL_0003: ldstr "Start Test"
+ IL_0008: call void [mscorlib]System.Console::WriteLine(string)
+ IL_000d: nop
+ .try
+ {
+ IL_000e: nop
+//Next line was change to
+ IL_0010: ldloc.s 5
+//From the following:
+// IL_000f: ldnull
+// IL_0010: stloc.1
+// IL_0011: ldloca.s V_1
+ IL_0013: ldstr "hello world"
+ IL_0018: call !!0 [mscorlib]System.Threading.Interlocked::Exchange<object>(!!0&,
+ !!0)
+ IL_001d: stloc.2
+ IL_001e: nop
+ IL_001f: leave.s IL_0044
+
+ } // end .try
+ catch [mscorlib]System.NullReferenceException
+ {
+ IL_0021: pop
+ IL_0022: nop
+ IL_0023: ldc.i4.s 100
+ IL_0025: stloc.0
+ IL_0026: nop
+ IL_0027: leave.s IL_0044
+
+ } // end handler
+ catch [mscorlib]System.Exception
+ {
+ IL_0029: stloc.3
+ IL_002a: nop
+ IL_002b: ldstr "Wrong exception thrown: "
+ IL_0030: ldloc.3
+ IL_0031: callvirt instance string [mscorlib]System.Object::ToString()
+ IL_0036: call string [mscorlib]System.String::Concat(string,
+ string)
+ IL_003b: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0040: nop
+ IL_0041: nop
+ IL_0042: leave.s IL_0044
+
+ } // end handler
+ IL_0044: nop
+ IL_0045: ldc.i4.s 100
+ IL_0047: ldloc.0
+ IL_0048: beq.s IL_0051
+
+ IL_004a: ldstr "Test Failed"
+ IL_004f: br.s IL_0056
+
+ IL_0051: ldstr "Test Passed"
+ IL_0056: call void [mscorlib]System.Console::WriteLine(string)
+ IL_005b: nop
+ IL_005c: ldloc.0
+ IL_005d: stloc.s V_4
+ IL_005f: br.s IL_0061
+
+ IL_0061: ldloc.s V_4
+ IL_0063: ret
+ } // end of method Test::Main
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+} // end of class Test
diff --git a/tests/src/baseservices/threading/interlocked/exchange/exchangetstring.cs b/tests/src/baseservices/threading/interlocked/exchange/exchangetstring.cs
new file mode 100644
index 0000000000..6c6f4865e8
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/exchange/exchangetstring.cs
@@ -0,0 +1,177 @@
+// 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.Threading;
+using System.Collections;
+
+class Class1
+{
+ static int Main(string[] args)
+ {
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe();
+
+ Console.WriteLine("Creating threads");
+ for (int i = 0; i < threads.Length - 1; i++)
+ {
+ if (i % 2 == 0)
+ threads[i] = new Thread(new
+ ParameterizedThreadStart(tsi.ThreadWorkerA));
+ else
+ threads[i] = new Thread(new
+ ParameterizedThreadStart(tsi.ThreadWorkerB));
+
+ threads[i].Start(args);
+ }
+
+ Console.WriteLine("Starting checker");
+ threads[threads.Length - 1] = new Thread(new ThreadStart(tsi.ThreadChecker));
+ threads[threads.Length - 1].Start();
+
+ //Added to prevent races where Checker does not get to Wait before ManualEvent is Set
+ while(tsi.ThreadCount < 100)
+ {
+ Thread.Sleep(100);
+ }
+ Thread.Sleep(100);
+ tsi.Signal();
+
+ Console.WriteLine("Joining threads");
+ for (int i = 0; i < threads.Length; i++)
+ threads[i].Join();
+
+ if (tsi.Pass)
+ rValue = 100;
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+}
+
+public class ThreadSafe
+{
+ ManualResetEvent signal;
+ private string curVal = "start string";
+ private int numberOfIterations;
+ private string newValueA = "hello";
+ private string newValueB = "world";
+ private bool success;
+ public volatile int ThreadCount = 0;
+
+ private volatile static object syncroot = new object();
+
+ public ThreadSafe(): this(10000) { }
+
+ public ThreadSafe(int loops)
+ {
+ success = true;
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorkerA(object obj)
+ {
+ string[] str = (string[])obj;
+ string ret = null;
+
+ // get the value
+ if(0 < str.Length)
+ {
+ if("null" == str[0])
+ newValueA = null;
+ else if("empty" == str[0])
+ newValueA = string.Empty;
+ else
+ newValueA = str[0];
+ }
+
+ lock(syncroot)
+ {
+ ThreadCount++;
+ }
+
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ {
+ ret = Interlocked.Exchange<string>(ref curVal, newValueA);
+
+ // Check return value
+ if(ret != newValueB && ret != newValueA && ret != "start string")
+ {
+ Console.WriteLine(ret + "," + newValueB + "," + newValueA);
+ success = false;
+ }
+ }
+
+ }
+
+ public void ThreadWorkerB(object obj)
+ {
+ string[] str = (string[])obj;
+ string ret = null;
+
+ // get the value
+ if(2 == str.Length)
+ {
+ if("null" == str[1])
+ newValueB = null;
+ else if("empty" == str[1])
+ newValueB = string.Empty;
+ else
+ newValueB = str[1];
+ }
+
+ lock(syncroot)
+ {
+ ThreadCount++;
+ }
+
+ signal.WaitOne();
+ for (int i = 0; i < numberOfIterations; i++)
+ {
+ ret = Interlocked.Exchange<string>(ref curVal, newValueB);
+
+ // Check return value
+ if(ret != newValueB && ret != newValueA && ret != "start string")
+ {
+ Console.WriteLine(ret + "," + newValueB + "," + newValueA);
+ success = false;
+ }
+ }
+ }
+
+ public void ThreadChecker()
+ {
+ lock(syncroot)
+ {
+ ThreadCount++;
+ }
+
+ signal.WaitOne();
+ string tmpVal;
+ for (int i = 0; i < numberOfIterations; i++)
+ {
+ tmpVal = curVal;
+ if (tmpVal != newValueB && tmpVal != newValueA && tmpVal != "start string")
+ {
+ Console.WriteLine(tmpVal + "," + newValueB + "," + newValueA);
+ success = false;
+ }
+ Thread.Sleep(0);
+ }
+ }
+
+ public bool Pass
+ {
+ get
+ {
+ return (success);
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/increment/intinc.cs b/tests/src/baseservices/threading/interlocked/increment/intinc.cs
new file mode 100644
index 0000000000..0d484bd32e
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/increment/intinc.cs
@@ -0,0 +1,31 @@
+// 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.Threading;
+
+namespace InterlockedTest
+{
+ class InterlockTest
+ {
+ public static int Main(string[] Args)
+ {
+ int rValue;
+ int loops = 5000;
+ int threads = 50;
+ if (Args.Length == 2)
+ {
+ loops = Int32.Parse(Args[0]);
+ threads = Int32.Parse(Args[1]);
+ }
+ Console.WriteLine("Starting Interlocked test on {0} threads for {1} iterations.",threads,loops);
+
+ IntTest testInt = new IntTest(loops, threads);
+
+ Console.WriteLine("Check Increment: {0}", rValue = testInt.Inc());
+ Console.WriteLine("Test {0}", 100 == rValue ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/increment/intinc.csproj b/tests/src/baseservices/threading/interlocked/increment/intinc.csproj
new file mode 100644
index 0000000000..f692c977b5
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/increment/intinc.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="..\common\InterlockedHelper_CoreCLR.cs" />
+ <Compile Include="IntInc.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/increment/longinc.cs b/tests/src/baseservices/threading/interlocked/increment/longinc.cs
new file mode 100644
index 0000000000..74045ee951
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/increment/longinc.cs
@@ -0,0 +1,31 @@
+// 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.Threading;
+
+namespace InterlockedTest
+{
+ class InterlockTest
+ {
+ public static int Main(string[] Args)
+ {
+ int rValue;
+ int loops = 5000;
+ int threads = 50;
+ if (Args.Length == 2)
+ {
+ loops = Int32.Parse(Args[0]);
+ threads = Int32.Parse(Args[1]);
+ }
+ Console.WriteLine("Starting Interlocked test on {0} threads for {1} iterations.",threads,loops);
+
+ LongTest testLong = new LongTest(loops, threads);
+
+ Console.WriteLine("Check Decrement: {0}", rValue = testLong.Dec());
+ Console.WriteLine("Test {0}", 100 == rValue ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/increment/longinc.csproj b/tests/src/baseservices/threading/interlocked/increment/longinc.csproj
new file mode 100644
index 0000000000..499700a9dc
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/increment/longinc.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="..\common\InterlockedHelper_CoreCLR.cs" />
+ <Compile Include="LongInc.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/read/interlockedread.cs b/tests/src/baseservices/threading/interlocked/read/interlockedread.cs
new file mode 100644
index 0000000000..547a4b77af
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/read/interlockedread.cs
@@ -0,0 +1,41 @@
+// 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.Threading;
+
+class InterlockedRead
+{
+ ManualResetEvent mre;
+ long lCurr;
+ static int success;
+ const int expected = 5;
+
+ public InterlockedRead()
+ {
+ mre = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ InterlockedRead ir = new InterlockedRead();
+ ir.TestOne(Int64.MaxValue);
+ ir.TestOne(Int64.MinValue);
+ ir.TestOne(0);
+ ir.TestOne(Int32.MaxValue);
+ ir.TestOne(Int32.MinValue);
+ Console.WriteLine(success == expected ? "Test Passed" : "Test Failed");
+ return (success == expected) ? 100 : -1;
+ }
+
+ public void TestOne(long iValue)
+ {
+ bool bRet = true;
+ lCurr = iValue;
+ if(iValue != Interlocked.Read(ref lCurr))
+ bRet = false;
+ if(bRet)
+ success++;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/read/interlockedread.csproj b/tests/src/baseservices/threading/interlocked/read/interlockedread.csproj
new file mode 100644
index 0000000000..c84b1c58b3
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/read/interlockedread.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="InterlockedRead.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/interlocked/read/readthreads.cs b/tests/src/baseservices/threading/interlocked/read/readthreads.cs
new file mode 100644
index 0000000000..ad839dbc20
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/read/readthreads.cs
@@ -0,0 +1,97 @@
+// 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.Threading;
+
+namespace InterlockedRead
+{
+ class Read
+ {
+ static int Main(string[] args)
+ {
+ int rValue = 0;
+ Thread[] threads = new Thread[100];
+ ThreadSafe tsi = new ThreadSafe();
+ for (int i = 0; i < threads.Length-1; i++)
+ {
+ if(i%2==0)
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorkerA));
+ else
+ threads[i] = new Thread(new ThreadStart(tsi.ThreadWorkerB));
+ threads[i].Start();
+ }
+ threads[threads.Length-1] = new Thread(new ThreadStart(tsi.ThreadChecker));
+ threads[threads.Length-1].Start();
+ tsi.Signal();
+
+ for(int i=0;i<threads.Length;i++)
+ threads[i].Join();
+
+ if(tsi.Pass)
+ rValue = 100;
+ Console.WriteLine("Test {0}", rValue == 100 ? "Passed" : "Failed");
+ return rValue;
+ }
+ }
+
+ public class ThreadSafe
+ {
+ ManualResetEvent signal;
+ private long totalValue = Int64.MinValue;
+ private int numberOfIterations;
+ private long newValueA = 0;
+ private long newValueB = Int64.MinValue;
+ private bool success;
+ public ThreadSafe(): this(10000) { }
+ public ThreadSafe(int loops)
+ {
+ success = true;
+ signal = new ManualResetEvent(false);
+ numberOfIterations = loops;
+ }
+
+ public void Signal()
+ {
+ signal.Set();
+ }
+
+ public void ThreadWorkerA()
+ {
+ signal.WaitOne();
+ for(int i=0;i<numberOfIterations;i++)
+ Interlocked.Exchange(ref totalValue, newValueA);
+
+ }
+ public void ThreadWorkerB()
+ {
+ signal.WaitOne();
+ for(int i=0;i<numberOfIterations;i++)
+ Interlocked.Exchange(ref totalValue, newValueB);
+ }
+
+ public void ThreadChecker()
+ {
+ signal.WaitOne();
+ for(int i=0;i<numberOfIterations;i++)
+ {
+ long l = Interlocked.Read(ref totalValue);
+ if(l != newValueB && l != newValueA)
+ {
+ Console.WriteLine(l + "," +
+ newValueB + "," + newValueA);
+ success = false;
+ }
+ }
+ }
+
+ public bool Pass
+ {
+ get
+ {
+ return (success);
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/interlocked/read/readthreads.csproj b/tests/src/baseservices/threading/interlocked/read/readthreads.csproj
new file mode 100644
index 0000000000..133e9fcc71
--- /dev/null
+++ b/tests/src/baseservices/threading/interlocked/read/readthreads.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ReadThreads.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/ctorchk/ctorchk.cs b/tests/src/baseservices/threading/monitor/ctorchk/ctorchk.cs
new file mode 100644
index 0000000000..f6e9674ff9
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/ctorchk/ctorchk.cs
@@ -0,0 +1,30 @@
+// 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.Threading;
+using System.Reflection;
+
+class TestMonitor
+{
+ public static int Main()
+ {
+ // This will look for any private constructor.
+ // There shouldn't be one in Whidbey.
+ ConstructorInfo[] m = typeof(Monitor).GetConstructors(
+ BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
+ Console.WriteLine(m.Length);
+
+ if(m.Length > 0)
+ {
+ Console.WriteLine("Test FAILED!");
+ return 1;
+ }
+ else
+ {
+ Console.WriteLine("Test PASSED!");
+ return 100;
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/ctorchk/ctorchk.csproj b/tests/src/baseservices/threading/monitor/ctorchk/ctorchk.csproj
new file mode 100644
index 0000000000..dd246958b3
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/ctorchk/ctorchk.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CtorChk.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/enter/EnterNull.csproj b/tests/src/baseservices/threading/monitor/enter/EnterNull.csproj
new file mode 100644
index 0000000000..3ce834255a
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/enter/EnterNull.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="enternull.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/enter/enternull.cs b/tests/src/baseservices/threading/monitor/enter/enternull.cs
new file mode 100644
index 0000000000..fb793aa1e2
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/enter/enternull.cs
@@ -0,0 +1,25 @@
+// 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.Threading;
+
+public class Test
+{
+
+ public static int Main()
+ {
+ try
+ {
+ Monitor.Enter(null);
+ Console.WriteLine("Failed to throw exception on Monitor.Enter");
+ return 1;
+ }
+ catch(ArgumentNullException)
+ {
+ //Expected
+ }
+ return 100;
+ }
+}
+
diff --git a/tests/src/baseservices/threading/monitor/enter/monitorenter.cs b/tests/src/baseservices/threading/monitor/enter/monitorenter.cs
new file mode 100644
index 0000000000..0a9fc4ab4c
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/enter/monitorenter.cs
@@ -0,0 +1,501 @@
+// 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.Threading;
+using System.Collections.Generic;
+
+// disable warnings about various Monitor members being obsolete
+#pragma warning disable 0618
+
+class MonEnterTests
+{
+ int m_failed;
+
+ /// <summary>
+ /// Not really negative tests, but testing expected failure modes
+ /// </summary>
+ void NegTests()
+ {
+ Console.WriteLine("null object tests");
+ ExpectException<ArgumentNullException>(delegate { Monitor.Enter(null); });
+ ExpectException<ArgumentNullException>(delegate { Monitor.TryEnter(null); });
+ bool tookLock = false;
+ ExpectException<ArgumentNullException>(delegate { Monitor.Enter(null, ref tookLock); });
+ Assert(!tookLock);
+ tookLock = false;
+ ExpectException<ArgumentNullException>(delegate { Monitor.TryEnter(null, 0, ref tookLock); });
+ Assert(!tookLock);
+ tookLock = false;
+ ExpectException<ArgumentNullException>(delegate { Monitor.TryEnter(null, TimeSpan.Zero, ref tookLock); });
+ Assert(!tookLock);
+ ExpectException<ArgumentNullException>(delegate { Monitor.TryEnter(null, 0); });
+ ExpectException<ArgumentNullException>(delegate { Monitor.TryEnter(null, TimeSpan.Zero); });
+
+ Console.WriteLine("tookLock == true tests");
+ object obj = new object();
+ tookLock = true;
+ ExpectException<ArgumentException>(delegate { Monitor.Enter(obj, ref tookLock); });
+ AssertTookLockAndRelease(LockIsHeld.No, obj, false);
+ tookLock = true;
+ ExpectException<ArgumentException>(delegate { Monitor.TryEnter(obj, ref tookLock); });
+ AssertTookLockAndRelease(LockIsHeld.No, obj, false);
+ tookLock = true;
+ ExpectException<ArgumentException>(delegate { Monitor.TryEnter(obj, 0, ref tookLock); });
+ AssertTookLockAndRelease(LockIsHeld.No, obj, false);
+ tookLock = true;
+ ExpectException<ArgumentException>(delegate { Monitor.TryEnter(obj, TimeSpan.Zero, ref tookLock); });
+ AssertTookLockAndRelease(LockIsHeld.No, obj, false);
+
+ Console.WriteLine("timeout < -1");
+ tookLock = false;
+ ExpectException<ArgumentOutOfRangeException>(delegate { Monitor.TryEnter(obj, -2, ref tookLock); });
+ AssertTookLockAndRelease(LockIsHeld.No, obj, tookLock);
+ tookLock = false;
+ ExpectException<ArgumentOutOfRangeException>(delegate { Monitor.TryEnter(obj, TimeSpan.FromMilliseconds(-2), ref tookLock); });
+ AssertTookLockAndRelease(LockIsHeld.No, obj, tookLock);
+ ExpectException<ArgumentOutOfRangeException>(delegate { tookLock = Monitor.TryEnter(obj, -2); });
+ AssertTookLockAndRelease(LockIsHeld.No, obj, tookLock);
+ ExpectException<ArgumentOutOfRangeException>(delegate { tookLock = Monitor.TryEnter(obj, TimeSpan.FromMilliseconds(-2)); });
+ AssertTookLockAndRelease(LockIsHeld.No, obj, tookLock);
+
+ Console.WriteLine("timeout > int.Max");
+ tookLock = false;
+ ExpectException<ArgumentOutOfRangeException>(delegate { Monitor.TryEnter(obj, TimeSpan.FromMilliseconds((double)int.MaxValue + 1), ref tookLock); });
+ AssertTookLockAndRelease(LockIsHeld.No, obj, tookLock);
+ ExpectException<ArgumentOutOfRangeException>(delegate { tookLock = Monitor.TryEnter(obj, TimeSpan.FromMilliseconds((double)int.MaxValue + 1)); });
+ AssertTookLockAndRelease(LockIsHeld.No, obj, tookLock);
+ }
+
+
+ AutoResetEvent contentionStartEvent = new AutoResetEvent(false);
+ volatile bool contentionStarted;
+ volatile bool inContention;
+ AutoResetEvent contentionDoneEvent = new AutoResetEvent(false);
+
+ // for some reason I had to add these to get this to build in the test environment
+ delegate void Action();
+ delegate void Action<T>(T arg);
+ delegate void Action<T1,T2>(T1 arg1, T2 arg2);
+
+ /// <summary>
+ /// Runs a lock acquisition scenario (passed in via <paramref name="run"/>) with contention
+ /// on the lock.
+ /// </summary>
+ /// <param name="obj">The object to lock</param>
+ /// <param name="spins">How many times to spin while holding the lock</param>
+ /// <param name="run">A lock acquisition scenario to perform under contention (will be passed
+ /// <paramref name="obj"/> as the object to be locked)</param>
+ void RunWithContention(object obj, int spins, Action<object> run)
+ {
+ ThreadPool.QueueUserWorkItem(delegate
+ {
+ contentionStartEvent.WaitOne();
+ Monitor.Enter(obj);
+ inContention = true;
+ contentionStarted = true;
+ Thread.Sleep(0); // yield
+ inContention = false;
+ Monitor.Exit(obj);
+ contentionDoneEvent.Set();
+ });
+ contentionStarted = false;
+ inContention = false;
+ Thread.Sleep(1);
+ contentionStartEvent.Set();
+ int waitCount = 0;
+ while (!contentionStarted)
+ {
+ waitCount++;
+ if (waitCount > 30000)
+ {
+ //Thread.Yield is internal in CoreClr, so change it to Thread.Sleep(0)
+ // Thread.Yield();
+ Thread.Sleep(0);
+ waitCount = 0;
+ }
+ }
+ run(obj);
+ contentionDoneEvent.WaitOne();
+ }
+
+ /// <summary>
+ /// Runs all tests under varying levels of contention
+ /// </summary>
+ void ContentionVariants()
+ {
+ Console.WriteLine("--- no contention ---");
+ SyncBlkVariants(LockIsHeld.No, delegate(object o, Action<object> ac) { ac(o); });
+
+ Console.WriteLine("--- a little contention ---");
+ SyncBlkVariants(LockIsHeld.Maybe, delegate(object o, Action<object> ac) { RunWithContention(o, 10000, ac); });
+
+ Console.WriteLine("--- lots of contention ---");
+ SyncBlkVariants(LockIsHeld.Maybe, delegate(object o, Action<object> ac) { RunWithContention(o, 1000000, ac); });
+ }
+
+ /// <summary>
+ /// Runs all tests under each SyncBlk variation
+ /// </summary>
+ /// <param name="lockIsHeld">Whether to expect that the lock is being held (experiencing
+ /// contention) while each lock attempt is performed</param>
+ /// <param name="scenario">A lock contention scenario to run under each SyncBlk scenario. Is
+ /// passed an object that may or may not have a SyncBlk, and a lock acquisition scenario to run
+ /// under that level of contention</param>
+ void SyncBlkVariants(LockIsHeld lockIsHeld, Action<object, Action<object>> scenario)
+ {
+ Console.WriteLine("Positive tests, no SyncBlk");
+ MethodVariants(lockIsHeld, delegate(Action<object> innerScenario)
+ {
+ object obj = new object();
+ scenario(obj, delegate(object o) { innerScenario(o); });
+ });
+
+ Console.WriteLine("Positive tests, with HashCode");
+ MethodVariants(lockIsHeld, delegate(Action<object> innerScenario)
+ {
+ object obj = new object();
+ obj.GetHashCode();
+ scenario(obj, delegate(object o) { innerScenario(o); });
+ });
+
+ Console.WriteLine("Positive tests, with SyncBlk");
+ MethodVariants(lockIsHeld, delegate(Action<object> innerScenario)
+ {
+ object obj = new object();
+ obj.GetHashCode();
+ Monitor.Enter(obj);
+ Monitor.Exit(obj);
+ scenario(obj, delegate(object o) { innerScenario(o); });
+ });
+ }
+
+ enum LockIsHeld { Yes, No, Maybe }
+
+ LockIsHeld Reverse(LockIsHeld lockIsHeld)
+ {
+ switch (lockIsHeld)
+ {
+ case LockIsHeld.Yes:
+ return LockIsHeld.No;
+ case LockIsHeld.No:
+ return LockIsHeld.Yes;
+ default:
+ return lockIsHeld;
+ }
+ }
+
+ /// <summary>
+ /// Runs all lock acquisition scenarios inside of an outer contention/SyncBlk scenario
+ /// </summary>
+ /// <param name="lockIsHeld">whether to expect the lock to be held when we try to acquire it</param>
+ /// <param name="scenario">The contention/SyncBlk scenario to run each acquisition scenario inside of.</param>
+ void MethodVariants(LockIsHeld lockIsHeld, Action<Action<object>> scenario)
+ {
+ bool tookLock;
+
+ scenario(delegate(object obj)
+ {
+ Monitor.Enter(obj);
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, true);
+ });
+
+ scenario(delegate(object obj)
+ {
+ tookLock = false;
+ Monitor.Enter(obj, ref tookLock);
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, tookLock);
+ });
+
+ scenario(delegate(object obj)
+ {
+ tookLock = Monitor.TryEnter(obj);
+ AssertTookLockAndRelease(Reverse(lockIsHeld), obj, tookLock);
+ });
+
+ scenario(delegate(object obj)
+ {
+ tookLock = Monitor.TryEnter(obj, 0);
+ AssertTookLockAndRelease(Reverse(lockIsHeld), obj, tookLock);
+ });
+
+ scenario(delegate(object obj)
+ {
+ DateTime start = DateTime.Now;
+ tookLock = Monitor.TryEnter(obj, 10000);
+ double elapsed = (DateTime.Now - start).TotalSeconds;
+ AssertTookLockAndRelease(elapsed < 5.0 ? LockIsHeld.Yes : LockIsHeld.Maybe, obj, tookLock);
+ });
+
+ scenario(delegate(object obj)
+ {
+ tookLock = Monitor.TryEnter(obj, Timeout.Infinite);
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, tookLock);
+ });
+
+ scenario(delegate(object obj)
+ {
+ tookLock = Monitor.TryEnter(obj, TimeSpan.FromMilliseconds(0));
+ AssertTookLockAndRelease(Reverse(lockIsHeld), obj, tookLock);
+ });
+
+ scenario(delegate(object obj)
+ {
+ tookLock = Monitor.TryEnter(obj, TimeSpan.FromMilliseconds(10000));
+ AssertTookLockAndRelease(LockIsHeld.Maybe, obj, tookLock);
+ });
+
+ scenario(delegate(object obj)
+ {
+ tookLock = Monitor.TryEnter(obj, TimeSpan.FromMilliseconds(Timeout.Infinite));
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, tookLock);
+ });
+
+ scenario(delegate(object obj)
+ {
+ tookLock = false;
+ Monitor.TryEnter(obj, ref tookLock);
+ AssertTookLockAndRelease(Reverse(lockIsHeld), obj, tookLock);
+ });
+
+ scenario(delegate(object obj)
+ {
+ tookLock = false;
+ Monitor.TryEnter(obj, 0, ref tookLock);
+ AssertTookLockAndRelease(Reverse(lockIsHeld), obj, tookLock);
+ });
+
+ scenario(delegate(object obj)
+ {
+ tookLock = false;
+ Monitor.TryEnter(obj, 10000, ref tookLock);
+ AssertTookLockAndRelease(LockIsHeld.Maybe, obj, tookLock);
+ });
+
+ scenario(delegate(object obj)
+ {
+ tookLock = false;
+ Monitor.TryEnter(obj, Timeout.Infinite, ref tookLock);
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, tookLock);
+ });
+
+ scenario(delegate(object obj)
+ {
+ tookLock = false;
+ Monitor.TryEnter(obj, TimeSpan.FromMilliseconds(0), ref tookLock);
+ AssertTookLockAndRelease(Reverse(lockIsHeld), obj, tookLock);
+ });
+
+ scenario(delegate(object obj)
+ {
+ tookLock = false;
+ Monitor.TryEnter(obj, TimeSpan.FromMilliseconds(10000), ref tookLock);
+ AssertTookLockAndRelease(LockIsHeld.Maybe, obj, tookLock);
+ });
+
+ scenario(delegate(object obj)
+ {
+ tookLock = false;
+ Monitor.TryEnter(obj, TimeSpan.FromMilliseconds(Timeout.Infinite), ref tookLock);
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, tookLock);
+ });
+
+ if (lockIsHeld == LockIsHeld.No)
+ {
+ scenario(delegate(object obj)
+ {
+ Monitor.Enter(obj);
+ Monitor.Enter(obj);
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, true);
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, true);
+ AssertTookLockAndRelease(LockIsHeld.No, obj, false);
+ });
+
+ scenario(delegate(object obj)
+ {
+ Monitor.Enter(obj);
+ tookLock = false;
+ Monitor.Enter(obj, ref tookLock);
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, tookLock);
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, true);
+ AssertTookLockAndRelease(LockIsHeld.No, obj, false);
+ });
+
+ scenario(delegate(object obj)
+ {
+ Monitor.Enter(obj);
+ tookLock = false;
+ Monitor.TryEnter(obj, ref tookLock);
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, tookLock);
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, true);
+ AssertTookLockAndRelease(LockIsHeld.No, obj, false);
+ });
+
+ scenario(delegate(object obj)
+ {
+ Monitor.Enter(obj);
+ for (int i = 0; i < 70; i++)
+ {
+ Monitor.Enter(obj);
+ }
+ for (int i = 0; i < 70; i++)
+ {
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, true);
+ }
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, true);
+ AssertTookLockAndRelease(LockIsHeld.No, obj, false);
+ });
+
+ scenario(delegate(object obj)
+ {
+ Monitor.Enter(obj);
+ for (int i = 0; i < 70; i++)
+ {
+ tookLock = false;
+ Monitor.Enter(obj, ref tookLock);
+ Assert(tookLock);
+ }
+ for (int i = 0; i < 70; i++)
+ {
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, true);
+ }
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, true);
+ AssertTookLockAndRelease(LockIsHeld.No, obj, false);
+ });
+
+ scenario(delegate(object obj)
+ {
+ Monitor.Enter(obj);
+ for (int i = 0; i < 70; i++)
+ {
+ tookLock = false;
+ Monitor.TryEnter(obj, ref tookLock);
+ Assert(tookLock);
+ }
+ for (int i = 0; i < 70; i++)
+ {
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, true);
+ }
+ AssertTookLockAndRelease(LockIsHeld.Yes, obj, true);
+ AssertTookLockAndRelease(LockIsHeld.No, obj, false);
+ });
+ }
+ }
+
+ void AssertTookLockAndRelease(LockIsHeld expected, object obj, bool tookLock)
+ {
+ Assert((expected == LockIsHeld.Yes && tookLock) ||
+ (expected == LockIsHeld.No && !tookLock) ||
+ expected == LockIsHeld.Maybe);
+
+ if (tookLock) Assert(!inContention);
+
+ bool exitFailed = false;
+ try
+ {
+ Monitor.Exit(obj);
+ }
+ catch (SynchronizationLockException)
+ {
+ exitFailed = true;
+ }
+
+ Assert(tookLock == !exitFailed);
+ }
+
+ void ExpectException<T>(Action action) where T : Exception
+ {
+ try
+ {
+ action();
+ }
+ catch (Exception e)
+ {
+ if (!(e is T))
+ {
+ FailNoStack("Unexpected exception:\n{0}", e.ToString());
+ }
+ return;
+ }
+ Fail("Expected {0}, but got no exception!", typeof(T).Name);
+ }
+
+ void Assert(bool condition, string message)
+ {
+ if (!condition)
+ Fail(message);
+ }
+
+ void Assert(bool condition)
+ {
+ Assert(condition, "Assertion failed");
+ }
+
+ void Fail(string message, bool printStack)
+ {
+ m_failed++;
+ Console.WriteLine(message);
+ }
+
+ void Fail(string format, params object[] args)
+ {
+ Fail(string.Format(format, args), true);
+ }
+
+ void Fail(string format)
+ {
+ Fail(format, true);
+ }
+
+ void FailNoStack(string format, params object[] args)
+ {
+ Fail(string.Format(format, args), false);
+ }
+
+
+ void ThreadIdPosTests()
+ {
+ Console.WriteLine("*** High thread ID tests ***");
+
+ // Create a thread with an ID > 1023 (the largest tid that can be stored in an
+ // object header)
+
+ List<Thread> threads = new List<Thread>(1024);
+ for (int i = 0; i < 1024; i++)
+ {
+ threads.Add(new Thread(delegate() { Assert(false, "this thread should never run"); }));
+ }
+ Thread highThread = new Thread(delegate()
+ {
+ Assert(Thread.CurrentThread.ManagedThreadId > 1024);
+ ContentionVariants();
+ });
+ highThread.Start();
+ highThread.Join();
+ }
+
+ int Run()
+ {
+ NegTests();
+ ContentionVariants();
+ ThreadIdPosTests();
+ return m_failed;
+ }
+
+ static int Main()
+ {
+ MonEnterTests tests = new MonEnterTests();
+ int failed = tests.Run();
+ if (0 != failed)
+ {
+ Console.WriteLine("Failed!");
+ }
+ else
+ {
+ Console.WriteLine("Success!");
+ }
+ return 100 + failed;
+ }
+}
+
diff --git a/tests/src/baseservices/threading/monitor/enter/monitorenter.csproj b/tests/src/baseservices/threading/monitor/enter/monitorenter.csproj
new file mode 100644
index 0000000000..79bc37156a
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/enter/monitorenter.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="MonitorEnter.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/exit/ExitNull.csproj b/tests/src/baseservices/threading/monitor/exit/ExitNull.csproj
new file mode 100644
index 0000000000..cb1c447213
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/exit/ExitNull.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="exitnull.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/exit/exitnull.cs b/tests/src/baseservices/threading/monitor/exit/exitnull.cs
new file mode 100644
index 0000000000..12088c70da
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/exit/exitnull.cs
@@ -0,0 +1,25 @@
+// 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.Threading;
+
+public class Test
+{
+
+ public static int Main()
+ {
+ try
+ {
+ Monitor.Exit(null);
+ Console.WriteLine("Failed to throw exception on Monitor.Exit");
+ return 1;
+ }
+ catch(ArgumentNullException)
+ {
+ //Expected
+ }
+ return 100;
+ }
+}
+
diff --git a/tests/src/baseservices/threading/monitor/isentered/monitorisentered.cs b/tests/src/baseservices/threading/monitor/isentered/monitorisentered.cs
new file mode 100644
index 0000000000..153359ea74
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/isentered/monitorisentered.cs
@@ -0,0 +1,128 @@
+// 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.
+
+#define DEBUG //make sure the Contract calls actually do something
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Diagnostics.Contracts;
+
+
+public static class MonitorIsHeldTest
+{
+ static int s_result = 100;
+
+ static int Main()
+ {
+ try
+ {
+ RunNullTest();
+ RunTest(new object(), "object without SyncBlk");
+ RunTest(CreateObjectWithSyncBlk(), "object with SyncBlk");
+
+ Console.WriteLine(s_result == 100 ? "Success!" : "FAILED!");
+ return s_result;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Unhandled exception!");
+ Console.WriteLine(e);
+ return 999;
+ }
+ }
+
+ static object CreateObjectWithSyncBlk()
+ {
+ // force an object to have a SyncBlk, to exercise the IsEntered code that
+ // deals with these
+ object o = new object();
+ o.GetHashCode();
+ return o;
+ }
+
+ static void RunNullTest()
+ {
+ try
+ {
+ Monitor.IsEntered(null);
+ }
+ catch (ArgumentNullException)
+ {
+ // expected
+ return;
+ }
+
+ // no exception
+ Console.WriteLine("Monitor.IsEntered(null) did not throw ArgumentNullException");
+ s_result = 101;
+ }
+
+ static void RunTest(object obj, string caseName)
+ {
+ // lock not held by anyone
+ if (Monitor.IsEntered(obj))
+ {
+ Console.WriteLine("{0}: lock should be initially unheld, but IsEntered == true", caseName);
+ s_result = 102;
+ }
+
+ // lock held by this thread
+ lock (obj)
+ {
+ if (!Monitor.IsEntered(obj))
+ {
+ Console.WriteLine("{0}: lock should be held by this thread, but IsEntered == false", caseName);
+ s_result = 103;
+ }
+
+ // do it the way the user would
+ Contract.Assert(Monitor.IsEntered(obj));
+ }
+
+ // now it's released
+ if (Monitor.IsEntered(obj))
+ {
+ Console.WriteLine("{0}: lock should have been released, but IsEntered == true", caseName);
+ s_result = 104;
+ }
+
+ // do it the way the user would
+ Contract.Assert(!Monitor.IsEntered(obj));
+
+ // Make another thread hold the lock
+ ManualResetEventSlim lockHeldEvent = new ManualResetEventSlim();
+ ManualResetEventSlim releaseLockEvent = new ManualResetEventSlim();
+
+ Task otherThread = Task.Factory.StartNew(() =>
+ {
+ lock (obj)
+ {
+ Contract.Assert(Monitor.IsEntered(obj));
+ lockHeldEvent.Set();
+ releaseLockEvent.Wait();
+ }
+ });
+
+ lockHeldEvent.Wait();
+
+ // lock is held by other thread, so we should get "false"
+ if (Monitor.IsEntered(obj))
+ {
+ Console.WriteLine("{0}: lock should be held by other thread, but IsEntered == true", caseName);
+ s_result = 105;
+ }
+
+ releaseLockEvent.Set();
+ otherThread.Wait();
+
+ // lock is held by neither thread, so we should still get "false"
+ if (Monitor.IsEntered(obj))
+ {
+ Console.WriteLine("{0}: lock should not be held by any thread, but IsEntered == true", caseName);
+ s_result = 106;
+ }
+
+ }
+}
diff --git a/tests/src/baseservices/threading/monitor/isentered/monitorisentered.csproj b/tests/src/baseservices/threading/monitor/isentered/monitorisentered.csproj
new file mode 100644
index 0000000000..7046b7b665
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/isentered/monitorisentered.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="MonitorIsEntered.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/pulse/PulseNull.csproj b/tests/src/baseservices/threading/monitor/pulse/PulseNull.csproj
new file mode 100644
index 0000000000..d942471f08
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/pulse/PulseNull.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="pulsenull.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/pulse/pulsenull.cs b/tests/src/baseservices/threading/monitor/pulse/pulsenull.cs
new file mode 100644
index 0000000000..37ac2fa11c
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/pulse/pulsenull.cs
@@ -0,0 +1,25 @@
+// 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.Threading;
+
+public class Test
+{
+
+ public static int Main()
+ {
+ try
+ {
+ Monitor.Pulse(null);
+ Console.WriteLine("Failed to throw exception on Monitor.Pulse");
+ return 1;
+ }
+ catch(ArgumentNullException)
+ {
+ //Expected
+ }
+ return 100;
+ }
+}
+
diff --git a/tests/src/baseservices/threading/monitor/pulseall/PulseAllNull.csproj b/tests/src/baseservices/threading/monitor/pulseall/PulseAllNull.csproj
new file mode 100644
index 0000000000..02a5706b2a
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/pulseall/PulseAllNull.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="pulseallnull.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/pulseall/pulseallnull.cs b/tests/src/baseservices/threading/monitor/pulseall/pulseallnull.cs
new file mode 100644
index 0000000000..6c95478930
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/pulseall/pulseallnull.cs
@@ -0,0 +1,26 @@
+// 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.Threading;
+
+public class Test
+{
+
+ public static int Main()
+ {
+ try
+ {
+ Monitor.PulseAll(null);
+ Console.WriteLine("Failed to throw exception on Monitor.PulseAll");
+ return 1;
+ }
+ catch(ArgumentNullException)
+ {
+ //Expected
+ }
+ return 100;
+ }
+
+}
+
diff --git a/tests/src/baseservices/threading/monitor/tryenter/longtimeout.cs b/tests/src/baseservices/threading/monitor/tryenter/longtimeout.cs
new file mode 100644
index 0000000000..6e23ba5c3c
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/tryenter/longtimeout.cs
@@ -0,0 +1,92 @@
+// 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.Diagnostics;
+using System.Threading;
+
+//Repro for VSWhidbey 565042
+
+public class Repro
+{
+ public static object _monitor = new Object();
+ private ManualResetEvent _event;
+ private ManualResetEvent _event2;
+ public static int _status = 1;
+
+ public static int Main(string[] arguments)
+ {
+ return (new Repro().RunTest());
+ }
+
+ public int RunTest()
+ {
+ _event = new ManualResetEvent(false);
+ _event2 = new ManualResetEvent(false);
+
+ Thread thread1 = new Thread(this.Thread1);
+ thread1.Start();
+
+ Thread thread2 = new Thread(this.Thread2);
+ thread2.Start();
+
+ thread2.Join();
+ _event2.Set();
+
+ if (_status == 100)
+ Console.WriteLine("Test Passed");
+ else
+ Console.WriteLine("Test Failed");
+
+ return _status;
+ }
+
+ private void Thread1()
+ {
+ Monitor.Enter(_monitor);
+ _event.Set();
+
+ _event2.WaitOne();
+ Monitor.Exit(_monitor);
+ }
+
+ private void Thread2()
+ {
+ Stopwatch timer = new Stopwatch();
+ _event.WaitOne();
+
+ timer.Start();
+ for (int i=10;i<=30;i=i+10)
+ {
+ bool tookLock = false;
+ Monitor.TryEnter(_monitor, TimeSpan.FromSeconds(i), ref tookLock);
+
+ if(tookLock)
+ {
+ _status = 98;
+ Console.WriteLine("TryEnter got monitor that it should not have been able to....");
+ Monitor.Exit(_monitor);
+ break;
+ }
+ else
+ {
+ timer.Stop();
+ if ((timer.Elapsed + TimeSpan.FromSeconds(1)) < TimeSpan.FromSeconds(i))
+ {
+ Console.WriteLine("TryEnter returned early in {0}, but expected {1}", timer.Elapsed, TimeSpan.FromSeconds(i));
+ _status = 99;
+ break;
+ }
+ else
+ {
+ Console.WriteLine("TryEnter returned as expected in {0}, with expected {1}", timer.Elapsed, TimeSpan.FromSeconds(i));
+ }
+ timer = Stopwatch.StartNew();
+ }
+ }
+
+ if (_status == 1)
+ _status=100;
+ }
+}
diff --git a/tests/src/baseservices/threading/monitor/tryenter/longtimeout.csproj b/tests/src/baseservices/threading/monitor/tryenter/longtimeout.csproj
new file mode 100644
index 0000000000..4f24c44f81
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/tryenter/longtimeout.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="LongTimeOut.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/unownedlock/EnterExitExit.csproj b/tests/src/baseservices/threading/monitor/unownedlock/EnterExitExit.csproj
new file mode 100644
index 0000000000..8f07466caf
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/unownedlock/EnterExitExit.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="enterexitexit.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/unownedlock/NoEnterNewObject.csproj b/tests/src/baseservices/threading/monitor/unownedlock/NoEnterNewObject.csproj
new file mode 100644
index 0000000000..61e7f62fa2
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/unownedlock/NoEnterNewObject.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="noenterobjectnew.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/unownedlock/NoEnterObject.csproj b/tests/src/baseservices/threading/monitor/unownedlock/NoEnterObject.csproj
new file mode 100644
index 0000000000..e39e56d803
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/unownedlock/NoEnterObject.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="noenterobject.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/unownedlock/NoEnterValType.csproj b/tests/src/baseservices/threading/monitor/unownedlock/NoEnterValType.csproj
new file mode 100644
index 0000000000..7ced1b7953
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/unownedlock/NoEnterValType.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="noentervaltype.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/unownedlock/enterexitexit.cs b/tests/src/baseservices/threading/monitor/unownedlock/enterexitexit.cs
new file mode 100644
index 0000000000..b78290724c
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/unownedlock/enterexitexit.cs
@@ -0,0 +1,34 @@
+// 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.Threading;
+
+public class Test{
+
+ public static int Main()
+ {
+ int rValue = 0;
+ Object foo = new Object();
+
+ try{
+ Monitor.Enter(foo);
+ Monitor.Exit(foo);
+ }
+ catch
+ {
+ return -1;
+ }
+
+ try{
+ Monitor.Exit(foo);
+ rValue = -1;
+ }
+ catch(SynchronizationLockException)
+ {
+ rValue = 100;
+ }
+ Console.WriteLine(100 == rValue ? "Test Passed":"Test Failed");
+ return rValue;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/unownedlock/noenterobject.cs b/tests/src/baseservices/threading/monitor/unownedlock/noenterobject.cs
new file mode 100644
index 0000000000..e29646d0d3
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/unownedlock/noenterobject.cs
@@ -0,0 +1,25 @@
+// 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.Threading;
+
+public class Test{
+
+ public static int Main()
+ {
+ int rValue = 0;
+ Object foo = new Object();
+
+ try{
+ Monitor.Exit(foo);
+ rValue = -1;
+ }
+ catch(SynchronizationLockException)
+ {
+ rValue = 100;
+ }
+ Console.WriteLine(100 == rValue ? "Test Passed":"Test Failed");
+ return rValue;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/unownedlock/noenterobjectnew.cs b/tests/src/baseservices/threading/monitor/unownedlock/noenterobjectnew.cs
new file mode 100644
index 0000000000..0443fd7698
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/unownedlock/noenterobjectnew.cs
@@ -0,0 +1,24 @@
+// 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.Threading;
+
+public class Test{
+
+ public static int Main()
+ {
+ int rValue = 0;
+
+ try{
+ Monitor.Exit(new Object());
+ rValue = -1;
+ }
+ catch(SynchronizationLockException)
+ {
+ rValue = 100;
+ }
+ Console.WriteLine(100 == rValue ? "Test Passed":"Test Failed");
+ return rValue;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/unownedlock/noentervaltype.cs b/tests/src/baseservices/threading/monitor/unownedlock/noentervaltype.cs
new file mode 100644
index 0000000000..8b6479e64e
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/unownedlock/noentervaltype.cs
@@ -0,0 +1,25 @@
+// 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.Threading;
+
+public class Test{
+
+ public static int Main()
+ {
+ int rValue = 0;
+ int foo = 1;
+
+ try{
+ Monitor.Exit(foo);
+ rValue = -1;
+ }
+ catch(SynchronizationLockException)
+ {
+ rValue = 100;
+ }
+ Console.WriteLine(100 == rValue ? "Test Passed":"Test Failed");
+ return rValue;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/wait/waitnull.cs b/tests/src/baseservices/threading/monitor/wait/waitnull.cs
new file mode 100644
index 0000000000..e2748257d0
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/wait/waitnull.cs
@@ -0,0 +1,26 @@
+// 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.Threading;
+
+public class Test
+{
+
+ public static int Main()
+ {
+ try
+ {
+ Monitor.Wait(null, 0);
+ Console.WriteLine("Failed to throw exception on Monitor.Wait");
+ return 1;
+ }
+ catch(ArgumentNullException)
+ {
+ //Expected
+ }
+ return 100;
+ }
+}
+
diff --git a/tests/src/baseservices/threading/monitor/wait/waitnull.csproj b/tests/src/baseservices/threading/monitor/wait/waitnull.csproj
new file mode 100644
index 0000000000..b5f4be7a33
--- /dev/null
+++ b/tests/src/baseservices/threading/monitor/wait/waitnull.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitNull.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am01waitallneg.cs b/tests/src/baseservices/threading/mutex/abandonedmutex/am01waitallneg.cs
new file mode 100644
index 0000000000..c3f68a22ce
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/abandonedmutex/am01waitallneg.cs
@@ -0,0 +1,52 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private Mutex myMutex01 = new Mutex(false);
+ private Mutex myMutex02 = new Mutex(false);
+ private Mutex myMutex03 = new Mutex(false);
+ private ManualResetEvent myMRE = new ManualResetEvent(false);
+ private int iRet = -1;
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ wae.Run();
+ Console.WriteLine(wae.iRet == 100 ? "Test Passed!" : "Test Failed");
+ return wae.iRet;
+ }
+
+ private void Run()
+ {
+ Thread t = new Thread(new ThreadStart(this.AbandonTheMutex));
+ t.Start();
+ myMRE.WaitOne();
+
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(
+ new WaitHandle[]{myMutex01, myMutex02, myMutex03}, 5000);
+ Console.WriteLine("WaitAll did not throw an " +
+ "exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException am)
+ {
+ Console.WriteLine("AbandonedMutexException thrown! Checking values...");
+ if(-1 == am.MutexIndex && null == am.Mutex)
+ iRet = 100;
+ }
+ }
+
+ private void AbandonTheMutex()
+ {
+ myMutex03.WaitOne();
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+}
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am01waitallneg.csproj b/tests/src/baseservices/threading/mutex/abandonedmutex/am01waitallneg.csproj
new file mode 100644
index 0000000000..8b9f5b63ff
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/abandonedmutex/am01waitallneg.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AM01WaitAllNeg.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am02waitoneneg.cs b/tests/src/baseservices/threading/mutex/abandonedmutex/am02waitoneneg.cs
new file mode 100644
index 0000000000..4dc5171717
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/abandonedmutex/am02waitoneneg.cs
@@ -0,0 +1,59 @@
+// 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.Threading;
+
+class WaitOneEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+ private int iRet = -1;
+
+ public WaitOneEx()
+ {
+ myMutex = new Mutex(false);
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitOneEx wao = new WaitOneEx();
+ wao.Run();
+ Console.WriteLine(100 == wao.iRet ? "Test Passed" : "Test Failed");
+ return wao.iRet;
+ }
+
+ private void Run()
+ {
+ Console.WriteLine("Test abandoned mutex is thrown using WaitOne");
+ Thread t = new Thread(new ThreadStart(this.AbandonTheMutex));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Wait on an abandoned mutex");
+ bool bRet = myMutex.WaitOne(10000);
+ Console.WriteLine("WaitOne did not throw an exception!");
+ }
+ catch(AbandonedMutexException am)
+ {
+ Console.WriteLine("AbandonedMutexException thrown! Checking values...");
+ if(-1 == am.MutexIndex && null == am.Mutex)
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + e.ToString());
+ }
+ }
+
+ private void AbandonTheMutex()
+ {
+ Console.WriteLine("Acquire the Mutex");
+ myMutex.WaitOne();
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+}
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am02waitoneneg.csproj b/tests/src/baseservices/threading/mutex/abandonedmutex/am02waitoneneg.csproj
new file mode 100644
index 0000000000..7cee18deba
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/abandonedmutex/am02waitoneneg.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AM02WaitOneNeg.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am04waitany.cs b/tests/src/baseservices/threading/mutex/abandonedmutex/am04waitany.cs
new file mode 100644
index 0000000000..377d27d68a
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/abandonedmutex/am04waitany.cs
@@ -0,0 +1,113 @@
+// 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.Threading;
+
+// This is a non-9x test.
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+ private int iRet = -1;
+ private ManualResetEvent mre = new ManualResetEvent(false);
+
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: AM04WaitAny /size:<int> /pos:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iPos=-1, iSize = -1;;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/size:"))
+ {
+ iSize = Convert.ToInt32(args[i].Substring(6));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/pos:"))
+ {
+ iPos = Convert.ToInt32(args[i].Substring(5));
+ }
+ }
+
+ WaitAnyEx wae = new WaitAnyEx();
+ wae.Run(iSize, iPos);
+
+ Console.WriteLine(100 == wae.iRet ? "Test Passed" : "Test Failed");
+ return wae.iRet;
+ }
+
+ private void Run(int iArraySize, int iPosToAbandon)
+ {
+ Console.WriteLine("Abandon a particular mutex - " + iArraySize + ", " +
+ iPosToAbandon);
+ CreateMutexArray(iArraySize, iPosToAbandon);
+ Thread t = new Thread(new
+ ParameterizedThreadStart(this.AbandonMutexPos));
+ t.Start(iPosToAbandon);
+ mre.WaitOne();
+ int i = -1;
+
+ try
+ {
+ Console.WriteLine("Waiting...");
+ i = WaitHandle.WaitAny(wh, -1);
+ }
+ catch(AbandonedMutexException am)
+ {
+ Console.WriteLine("AbandonedMutexException thrown! Checking values...");
+ if(iPosToAbandon == am.MutexIndex && wh[am.MutexIndex] == am.Mutex)
+ iRet = 50;
+
+ // We should now be in a state where this thread owns the mutex
+ am.Mutex.WaitOne();
+ am.Mutex.ReleaseMutex();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ t.Join();
+
+ // Release a 2nd time
+ try
+ {
+ Console.WriteLine("Release again");
+ ((Mutex)wh[iPosToAbandon]).ReleaseMutex();
+ iRet += 50;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ }
+
+ private void AbandonMutexPos(Object o)
+ {
+ wh[Convert.ToInt32(o)].WaitOne();
+ mre.Set();
+ }
+
+ private void CreateMutexArray(int numElements, int iPos)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ if(i != iPos)
+ wh[i] = new AutoResetEvent(false);
+ else
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am04waitany.csproj b/tests/src/baseservices/threading/mutex/abandonedmutex/am04waitany.csproj
new file mode 100644
index 0000000000..16e6425b08
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/abandonedmutex/am04waitany.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/size:10 /pos:0</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AM04WaitAny.cs" />
+ <Compile Include="..\OpenMutexCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am05waitanymutex.cs b/tests/src/baseservices/threading/mutex/abandonedmutex/am05waitanymutex.cs
new file mode 100644
index 0000000000..0f093d8b41
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/abandonedmutex/am05waitanymutex.cs
@@ -0,0 +1,112 @@
+// 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.Threading;
+
+// This is a non-9x test.
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+ private int iRet = -1;
+ private ManualResetEvent mre = new ManualResetEvent(false);
+
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: AM05WaitAny /size:<int> /pos:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iPos=-1, iSize = -1;;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/size:"))
+ {
+ iSize = Convert.ToInt32(args[i].Substring(6));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/pos:"))
+ {
+ iPos = Convert.ToInt32(args[i].Substring(5));
+ }
+ }
+
+ WaitAnyEx wae = new WaitAnyEx();
+ wae.Run(iSize, iPos);
+
+ Console.WriteLine(100 == wae.iRet ? "Test Passed" : "Test Failed");
+ return wae.iRet;
+ }
+
+ private void Run(int iArraySize, int iPosToAbandon)
+ {
+ Console.WriteLine("Abandon a particular mutex - " + iArraySize + ", " +
+ iPosToAbandon);
+ CreateMutexArray(iArraySize);
+
+ Thread t2 = new Thread(new ParameterizedThreadStart(this.AbandonElse));
+ t2.Start(iPosToAbandon);
+
+ // Let the thread work
+ Thread.Sleep(1000);
+
+ Thread t = new Thread(new
+ ParameterizedThreadStart(this.AbandonMutexPos));
+ t.Start(iPosToAbandon);
+ mre.WaitOne();
+ int i = -1;
+
+ try
+ {
+ Console.WriteLine("Waiting...");
+ i = WaitHandle.WaitAny(wh, -1);
+ Console.WriteLine("No exception thrown - " + i);
+ }
+ catch(AbandonedMutexException am)
+ {
+ Console.WriteLine("AbandonedMutexException thrown! Checking values...");
+ if(iPosToAbandon == am.MutexIndex && wh[am.MutexIndex] == am.Mutex)
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ }
+
+ private void AbandonElse(Object o)
+ {
+ // Do a wait on all of them so it blocks WaitAny()
+ for(int i=0;i<wh.Length;i++)
+ {
+ if(i != Convert.ToInt32(o))
+ wh[i].WaitOne();
+ }
+ mre.WaitOne();
+ Thread.Sleep(5000);
+ }
+
+ private void AbandonMutexPos(Object o)
+ {
+ wh[Convert.ToInt32(o)].WaitOne();
+ mre.Set();
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am05waitanymutex.csproj b/tests/src/baseservices/threading/mutex/abandonedmutex/am05waitanymutex.csproj
new file mode 100644
index 0000000000..1a2fb1606c
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/abandonedmutex/am05waitanymutex.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/size:64 /pos:63</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AM05WaitAnyMutex.cs" />
+ <Compile Include="..\OpenMutexCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am06abandonall.cs b/tests/src/baseservices/threading/mutex/abandonedmutex/am06abandonall.cs
new file mode 100644
index 0000000000..650dcb0dd6
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/abandonedmutex/am06abandonall.cs
@@ -0,0 +1,70 @@
+// 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.Threading;
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon all mutexes in array");
+ CreateMutexArray(64);
+ myMRE = new ManualResetEvent(false);
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexes));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(wh, 10000);
+ Console.WriteLine("WaitAny did not throw an " +
+ "exception, i = " + i);
+ }
+ catch(AbandonedMutexException am)
+ {
+ Console.WriteLine("AbandonedMutexException thrown! Checking values...");
+ if(am.MutexIndex == 0 && am.Mutex == wh[am.MutexIndex])
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexes()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am06abandonall.csproj b/tests/src/baseservices/threading/mutex/abandonedmutex/am06abandonall.csproj
new file mode 100644
index 0000000000..27f5c4c153
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/abandonedmutex/am06abandonall.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AM06AbandonAll.cs" />
+ <Compile Include="..\OpenMutexCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am07abandonmultiplemutex.cs b/tests/src/baseservices/threading/mutex/abandonedmutex/am07abandonmultiplemutex.cs
new file mode 100644
index 0000000000..f4e6d4a40b
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/abandonedmutex/am07abandonmultiplemutex.cs
@@ -0,0 +1,96 @@
+// 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.Threading;
+
+// This is a non-9x test.
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+ private int iRet = -1;
+ private ManualResetEvent mre = new ManualResetEvent(false);
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ wae.Run();
+
+ Console.WriteLine(100 == wae.iRet ? "Test Passed" : "Test Failed");
+ return wae.iRet;
+ }
+
+ private void Run()
+ {
+ CreateMutexArray(64);
+ int[] aPos = new int[5]{6,8,10,12,14};
+ Thread t2 = new Thread(new ParameterizedThreadStart(this.AbandonElse));
+ t2.Start(aPos[0]);
+
+ Thread t = new Thread(new
+ ParameterizedThreadStart(this.AbandonMutexPos));
+ t.Start(aPos);
+ mre.WaitOne();
+ int i = -1;
+ Thread.Sleep(400);
+
+ try
+ {
+ Console.WriteLine("Waiting...");
+ i = WaitHandle.WaitAny(wh, -1);
+ Console.WriteLine("No exception thrown - {0}", i);
+ }
+ catch(AbandonedMutexException am)
+ {
+ Console.WriteLine("AbandonedMutexException thrown! Checking values...");
+ if(aPos[0] == am.MutexIndex && wh[am.MutexIndex] == am.Mutex)
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ t.Join();
+ }
+
+ private void AbandonElse(Object o)
+ {
+ int iPos = (int)o;
+
+ // Do a wait on all Mutexes up to the 1st one
+ for(int i=0;i<iPos;i++)
+ {
+ wh[i].WaitOne();
+ Console.WriteLine("Blocking {0}", i);
+ }
+
+ mre.WaitOne();
+ Thread.Sleep(5000);
+ }
+
+ private void AbandonMutexPos(Object o)
+ {
+ // This thread needs to complete before the wait
+ // otherwise the Wait will return immediately
+
+ int[] iPos = (int[])o;
+ for(int i=0;i<iPos.Length;i++)
+ {
+ wh[iPos[i]].WaitOne();
+ Console.WriteLine(iPos[i]);
+ }
+ mre.Set();
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am07abandonmultiplemutex.csproj b/tests/src/baseservices/threading/mutex/abandonedmutex/am07abandonmultiplemutex.csproj
new file mode 100644
index 0000000000..41e0436e0d
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/abandonedmutex/am07abandonmultiplemutex.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AM07AbandonMultipleMutex.cs" />
+ <Compile Include="..\OpenMutexCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am08mixedarray.cs b/tests/src/baseservices/threading/mutex/abandonedmutex/am08mixedarray.cs
new file mode 100644
index 0000000000..b61f42c665
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/abandonedmutex/am08mixedarray.cs
@@ -0,0 +1,119 @@
+// 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.Threading;
+
+// This is a non-9x test.
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+ ManualResetEvent mre = new ManualResetEvent(false);
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandoning only one Mutex in array with other WaitHandles, signaling other mutexes");
+ CreateArray(64);
+ Thread t = new Thread(new ThreadStart(this.WaitOnAllExceptPos));
+ t.Start();
+
+ Thread t2 = new Thread(new ThreadStart(this.AbandonLastMutex));
+ t2.Start();
+
+ mre.WaitOne();
+ mre.Reset();
+ t2.Join(); // make sure the thread has exited before checking for the abandoned mutex
+
+ int i = -1;
+ try
+ {
+ Console.WriteLine("Waiting...");
+ i = WaitHandle.WaitAny(wh, 5000);
+ Console.WriteLine("WaitAny did not throw AbandonedMutexExcpetion");
+ Console.WriteLine("Object at position {0} ({1}) returned", i, wh[i].GetType());
+ }
+ catch(AbandonedMutexException am)
+ {
+ Console.WriteLine("AbandonedMutexException thrown! Checking values...");
+ if(61 == am.MutexIndex)
+ {
+ if (am.Mutex == wh[am.MutexIndex])
+ iRet = 100;
+ else
+ Console.WriteLine("Expected AbandonedMutexException to == Indexed Mutex, but it does not.");
+ }
+ else
+ Console.WriteLine("Expected return of 61, but found " + am.MutexIndex);
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void WaitOnAllExceptPos()
+ {
+ Mutex m = new Mutex();
+ bool bSet = false;
+ for(int i=wh.Length-1;i>=0;i--)
+ {
+ if(wh[i].GetType() == m.GetType())
+ {
+ if(bSet)
+ {
+ wh[i].WaitOne();
+ Console.Write(i + ".");
+ }
+ bSet = true;
+ }
+ }
+ mre.Set();
+ //This Sleep keeps Thread alive to hold Mutexes
+ Thread.Sleep(15000);
+ }
+
+ private void AbandonLastMutex()
+ {
+ Mutex m = new Mutex();
+ for(int i=wh.Length-1;i>=0;i--)
+ {
+ if(wh[i].GetType() == m.GetType())
+ {
+ wh[i].WaitOne();
+ Console.WriteLine(i + "AbandonLastMutex.");
+ break;
+ }
+ }
+ }
+
+ private void CreateArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ switch(i%3)
+ {
+ case 0:
+ wh[i] = new ManualResetEvent(false);
+ break;
+ case 1:
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ break;
+ case 2:
+ wh[i] = new Semaphore(0,5);
+ break;
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am08mixedarray.csproj b/tests/src/baseservices/threading/mutex/abandonedmutex/am08mixedarray.csproj
new file mode 100644
index 0000000000..b27f4dbcc1
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/abandonedmutex/am08mixedarray.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="AM08MixedArray.cs" />
+ <Compile Include="..\OpenMutexCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/misc/mutexctor1.cs b/tests/src/baseservices/threading/mutex/misc/mutexctor1.cs
new file mode 100644
index 0000000000..e82bb26c37
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/misc/mutexctor1.cs
@@ -0,0 +1,173 @@
+// 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.Threading; // For Thread, Mutex
+
+/// <summary>
+/// Ctor(Boolean)
+/// </summary>
+///
+// Tests that you can create a mutex, that if the mutex is
+// owned that other threads cannot change shared state governed
+// by that mutex, and that if it is unowned we can pick it up
+// without blocking.
+public class MutexCtor1
+{
+ #region Public Fields
+ public const int c_DEFAULT_INT_VALUE = 0;
+
+ public volatile static int m_SharedResource = c_DEFAULT_INT_VALUE;
+ #endregion
+
+ #region Private Fields
+ private const int c_DEFAULT_SLEEP_TIME = 1000; // 1 second
+
+ private Mutex m_Mutex = null;
+ #endregion
+
+ #region Public Methods
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+ retVal = PosTest2() && retVal;
+
+ return retVal;
+ }
+
+ #region Positive Test Cases
+ public bool PosTest1()
+ {
+ bool retVal = true;
+ Thread thread = null;
+
+ // Add your scenario description here
+ TestLibrary.TestFramework.BeginScenario("PosTest1: Construct a new Mutex instance with initiallyOwned set to true (ensure that the thread owns the mutex)");
+
+ using(m_Mutex = new Mutex(true))
+ {
+ try
+ {
+ do
+ {
+ if (null == m_Mutex)
+ {
+ TestLibrary.TestFramework.LogError("001", "Can not construct a new Mutex intance with initiallyOwned set to true.");
+ retVal = false;
+
+ break;
+ }
+
+ // Ensure initial owner of the mutex is current thread
+
+ // Create another thread to change value of m_SharedResource
+ thread = new Thread(new ThreadStart(ThreadProc));
+ thread.Start();
+
+ // Sleep 1 second to wait the thread get started
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME);
+
+ if (m_SharedResource != c_DEFAULT_INT_VALUE)
+ {
+ TestLibrary.TestFramework.LogError("002", "Call Mutex(true) does not set current thread to be the owner of the mutex.");
+ retVal = false;
+ }
+ m_Mutex.ReleaseMutex();
+ } while (false); // do
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("003", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ if (null != thread)
+ {
+ // Wait until all threads are terminated
+ thread.Join();
+ }
+
+ // Reset the value of m_SharedResource for further usage
+ m_SharedResource = c_DEFAULT_INT_VALUE;
+ }
+ }
+
+ return retVal;
+ }
+
+ public bool PosTest2()
+ {
+ bool retVal = true;
+
+ // Add your scenario description here
+ TestLibrary.TestFramework.BeginScenario("PosTest2: Construct a new Mutex instance with initiallyOwned set to false. Ensure that the thread does not own the mutex");
+
+ using (m_Mutex = new Mutex(false))
+ {
+ try
+ {
+ if (null == m_Mutex)
+ {
+ TestLibrary.TestFramework.LogError("004", "Can not construct a new Mutex intance with initiallyOwned set to false.");
+ retVal = false;
+ }
+ else
+ {
+ // this would block this thread if we owned the mutex
+ m_Mutex.WaitOne();
+ m_Mutex.ReleaseMutex();
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("006", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ // Reset the value of m_SharedResource for further usage
+ m_SharedResource = c_DEFAULT_INT_VALUE;
+ }
+ }
+
+ return retVal;
+ }
+ #endregion
+ #endregion
+
+ public static int Main()
+ {
+ MutexCtor1 test = new MutexCtor1();
+
+ TestLibrary.TestFramework.BeginTestCase("MutexCtor1");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ #region Private Methods
+ private void ThreadProc()
+ {
+ m_Mutex.WaitOne();
+ m_SharedResource++;
+ m_Mutex.ReleaseMutex();
+ }
+ #endregion
+}
diff --git a/tests/src/baseservices/threading/mutex/misc/mutexctor1.csproj b/tests/src/baseservices/threading/mutex/misc/mutexctor1.csproj
new file mode 100644
index 0000000000..dc9e568ca3
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/misc/mutexctor1.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="MutexCtor1.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/misc/mutexctor2.cs b/tests/src/baseservices/threading/mutex/misc/mutexctor2.cs
new file mode 100644
index 0000000000..0dff03ec8c
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/misc/mutexctor2.cs
@@ -0,0 +1,104 @@
+// 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.Threading; // For Thread, Mutex
+
+/// <summary>
+/// Ctor()
+/// </summary>
+///
+// tests the default mutex constructor creates
+// a mutex which is not owned.
+public class MutexCtor2
+{
+ #region Public Fields
+ public const int c_DEFAULT_INT_VALUE = 0;
+
+ public static int m_SharedResource = c_DEFAULT_INT_VALUE;
+ #endregion
+
+ #region Private Fields
+ private Mutex m_Mutex = null;
+ #endregion
+
+ #region Public Methods
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+
+ return retVal;
+ }
+
+ #region Positive Test Cases
+ public bool PosTest1()
+ {
+ bool retVal = true;
+
+ // Add your scenario description here
+ TestLibrary.TestFramework.BeginScenario("PosTest1: Construct a new Mutex instance");
+
+ // create the mutex in unowned state
+ using (m_Mutex = new Mutex())
+ {
+ try
+ {
+ do
+ {
+ if (null == m_Mutex)
+ {
+ TestLibrary.TestFramework.LogError("001", "Can not construct a new Mutex intance");
+ retVal = false;
+
+ break;
+ }
+
+ // Ensure initial owner of the mutex is not the current thread
+ // This call should NOT block
+ m_Mutex.WaitOne();
+ m_Mutex.ReleaseMutex();
+
+ } while (false); // do
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("003", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ // Reset the value of m_SharedResource for further usage
+ m_SharedResource = c_DEFAULT_INT_VALUE;
+ }
+ }
+
+ return retVal;
+ }
+ #endregion
+ #endregion
+
+ public static int Main()
+ {
+ MutexCtor2 test = new MutexCtor2();
+
+ TestLibrary.TestFramework.BeginTestCase("MutexCtor2");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/mutex/misc/mutexctor2.csproj b/tests/src/baseservices/threading/mutex/misc/mutexctor2.csproj
new file mode 100644
index 0000000000..47f002fb1b
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/misc/mutexctor2.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="MutexCtor2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/misc/waitone1.cs b/tests/src/baseservices/threading/mutex/misc/waitone1.cs
new file mode 100644
index 0000000000..40f144b66b
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/misc/waitone1.cs
@@ -0,0 +1,217 @@
+// 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.Threading; // For Thread, Mutex
+
+/// <summary>
+/// WaitOne()
+/// </summary>
+///
+// Tests that Mutex.WaitOne will block when another
+// thread holds the mutex, and then will grab the mutex
+// when it is released. Also that appropriate exceptions
+// are thrown if the other thread abandons or disposes of
+// the mutex
+public class MutexWaitOne1
+{
+ #region Private Fields
+ private const int c_DEFAULT_SLEEP_TIME = 1000; // 1 second
+
+ private Mutex m_Mutex = null;
+ #endregion
+
+ #region Public Methods
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+
+ TestLibrary.TestFramework.LogInformation("[Negative]");
+ retVal = NegTest1() && retVal;
+ retVal = NegTest2() && retVal;
+
+ return retVal;
+ }
+
+ #region Positive Test Cases
+ public bool PosTest1()
+ {
+ bool retVal = true;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: WaitOne returns true when current instance receives a signal");
+
+ try
+ {
+ do
+ {
+ m_Mutex = new Mutex();
+ thread = new Thread(new ThreadStart(SignalMutex));
+ thread.Start();
+
+ if (m_Mutex.WaitOne() != true)
+ {
+ TestLibrary.TestFramework.LogError("001", "WaitOne returns false when current instance receives a signal.");
+ retVal = false;
+
+ break;
+ }
+
+ m_Mutex.ReleaseMutex();
+ } while (false); // do
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ // Wait for the thread to terminate
+ if (null != thread)
+ {
+ thread.Join();
+ }
+
+ m_Mutex.Dispose();
+ }
+
+ return retVal;
+ }
+ #endregion
+
+ #region Negative Test Cases
+ public bool NegTest1()
+ {
+ bool retVal = true;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("NegTest1: AbandonedMutexException should be thrown if a thread exited without releasing a mutex");
+
+ using (m_Mutex = new Mutex(false))
+ {
+ try
+ {
+ thread = new Thread(new ThreadStart(NeverReleaseMutex));
+ thread.Start();
+
+ Thread.Sleep(100);
+ m_Mutex.WaitOne();
+
+ TestLibrary.TestFramework.LogError("101", "AbandonedMutexException is not thrown if a thread exited without releasing a mutex");
+ retVal = false;
+ }
+ catch (AbandonedMutexException)
+ {
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("102", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ if (null != thread)
+ {
+ thread.Join();
+ }
+ }
+ }
+
+ return retVal;
+ }
+
+ public bool NegTest2()
+ {
+ bool retVal = true;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("NegTest2: ObjectDisposedException should be thrown if current instance has already been disposed");
+
+ try
+ {
+ m_Mutex = new Mutex();
+
+ thread = new Thread(new ThreadStart(DisposeMutex));
+ thread.Start();
+
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME);
+ m_Mutex.WaitOne();
+
+ TestLibrary.TestFramework.LogError("103", "ObjectDisposedException is not thrown if current instance has already been disposed");
+ retVal = false;
+ }
+ catch (ObjectDisposedException)
+ {
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("104", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ if (null != thread)
+ {
+ thread.Join();
+ }
+
+ if (null != m_Mutex)
+ {
+ ((IDisposable)m_Mutex).Dispose();
+ }
+ }
+
+ return retVal;
+ }
+ #endregion
+ #endregion
+
+ public static int Main()
+ {
+ MutexWaitOne1 test = new MutexWaitOne1();
+
+ TestLibrary.TestFramework.BeginTestCase("MutexWaitOne1");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ #region Private Methods
+ private void SignalMutex()
+ {
+ m_Mutex.WaitOne();
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME);
+ m_Mutex.ReleaseMutex();
+ }
+
+ private void NeverReleaseMutex()
+ {
+ m_Mutex.WaitOne();
+ // Thread.Sleep(c_DEFAULT_SLEEP_TIME);
+ }
+
+ private void DisposeMutex()
+ {
+ // Thread.Sleep(c_DEFAULT_SLEEP_TIME);
+ ((IDisposable)m_Mutex).Dispose();
+ }
+ #endregion
+}
diff --git a/tests/src/baseservices/threading/mutex/misc/waitone1.csproj b/tests/src/baseservices/threading/mutex/misc/waitone1.csproj
new file mode 100644
index 0000000000..e52d672994
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/misc/waitone1.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitOne1.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/misc/waitone2.cs b/tests/src/baseservices/threading/mutex/misc/waitone2.cs
new file mode 100644
index 0000000000..8c0a94d5a8
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/misc/waitone2.cs
@@ -0,0 +1,573 @@
+// 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.Threading; // For Thread, Mutex
+
+public class TestContextBoundObject
+{
+ public void TestMethod()
+ {
+ Thread.Sleep(MutexWaitOne2.c_LONG_SLEEP_TIME);
+ }
+}
+
+/// <summary>
+/// WaitOne(System.Int32, System.Boolean)
+/// </summary>
+///
+
+// Exercises Mutex:
+// Waits infinitely,
+// Waits a finite time,
+// Times out appropriately,
+// Throws Exceptions appropriately.
+public class MutexWaitOne2
+{
+ #region Public Constants
+ public const int c_DEFAULT_SLEEP_TIME = 1000; // 1 second
+ public const int c_LONG_SLEEP_TIME = 5000; // 5 second
+ #endregion
+
+ #region Private Fields
+ private Mutex m_Mutex = null;
+ #endregion
+
+ #region Public Methods
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+ retVal = PosTest2() && retVal;
+ retVal = PosTest3() && retVal;
+ retVal = PosTest4() && retVal;
+ retVal = PosTest5() && retVal;
+ retVal = PosTest6() && retVal;
+ retVal = PosTest7() && retVal;
+
+ TestLibrary.TestFramework.LogInformation("[Negative]");
+ retVal = NegTest1() && retVal;
+ retVal = NegTest2() && retVal;
+ retVal = NegTest3() && retVal;
+
+ return retVal;
+ }
+
+ #region Positive Test Cases
+ public bool PosTest1()
+ {
+ bool retVal = true;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: Wait Infinite");
+
+ try
+ {
+ do
+ {
+ m_Mutex = new Mutex();
+
+ thread = new Thread(new ThreadStart(SleepLongTime));
+ thread.Start();
+
+ if (m_Mutex.WaitOne(Timeout.Infinite) != true)
+ {
+ TestLibrary.TestFramework.LogError("001", "Can not wait Infinite");
+ retVal = false;
+
+ break;
+ }
+
+ m_Mutex.ReleaseMutex();
+
+ } while (false); // do
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ // Wait for the thread to terminate
+ if (null != thread)
+ {
+ thread.Join();
+ }
+
+ if (null != m_Mutex)
+ {
+ m_Mutex.Dispose();
+ }
+ }
+
+ return retVal;
+ }
+
+ public bool PosTest2()
+ {
+ bool retVal = true;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest2: Wait some finite time");
+
+ try
+ {
+ m_Mutex = new Mutex();
+
+ thread = new Thread(new ThreadStart(SignalMutex));
+ thread.Start();
+
+ m_Mutex.WaitOne(2 * c_DEFAULT_SLEEP_TIME);
+
+ m_Mutex.ReleaseMutex();
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("003", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ // Wait for the thread to terminate
+ if (null != thread)
+ {
+ thread.Join();
+ }
+
+ if (null != m_Mutex)
+ {
+ m_Mutex.Dispose();
+ }
+ }
+
+ return retVal;
+ }
+
+ public bool PosTest3()
+ {
+ bool retVal = true;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest3: Wait some finite time will quit for timeout");
+
+ try
+ {
+ m_Mutex = new Mutex();
+
+ thread = new Thread(new ThreadStart(SignalMutex));
+ thread.Start();
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME / 5); // To avoid race
+ if (false != m_Mutex.WaitOne(c_DEFAULT_SLEEP_TIME / 10))
+ {
+ m_Mutex.ReleaseMutex();
+ TestLibrary.TestFramework.LogError("004", "WaitOne returns true when wait time out");
+ retVal = false;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("005", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ // Wait for the thread to terminate
+ if (null != thread)
+ {
+ thread.Join();
+ }
+
+ if (null != m_Mutex)
+ {
+ m_Mutex.Dispose();
+ }
+ }
+
+ return retVal;
+ }
+
+ public bool PosTest4()
+ {
+ bool retVal = true;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest4: Wait some finite time will quit for timeout when another thread is in nondefault managed context");
+
+ try
+ {
+ m_Mutex = new Mutex();
+
+ thread = new Thread(new ThreadStart(CallContextBoundObjectMethod));
+ thread.Start();
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME / 5); // To avoid race
+ if (false != m_Mutex.WaitOne(c_DEFAULT_SLEEP_TIME))
+ {
+ m_Mutex.ReleaseMutex();
+ TestLibrary.TestFramework.LogError("006", "WaitOne returns true when wait some finite time will quit for timeout when another thread is in nondefault managed context");
+ retVal = false;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("007", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ // Wait for the thread to terminate
+ if (null != thread)
+ {
+ thread.Join();
+ }
+
+ if (null != m_Mutex)
+ {
+ m_Mutex.Dispose();
+ }
+ }
+
+ return retVal;
+ }
+
+ public bool PosTest5()
+ {
+ bool retVal = true;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest5: Wait some finite time will quit for timeout when another thread is in nondefault managed context");
+
+ try
+ {
+ m_Mutex = new Mutex();
+
+ thread = new Thread(new ThreadStart(CallContextBoundObjectMethod));
+ thread.Start();
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME / 5); // To avoid race
+ if (false != m_Mutex.WaitOne(c_DEFAULT_SLEEP_TIME))
+ {
+ m_Mutex.ReleaseMutex();
+ TestLibrary.TestFramework.LogError("008", "WaitOne returns true when wait some finite time will quit for timeout when another thread is in nondefault managed context");
+ retVal = false;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("009", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ // Wait for the thread to terminate
+ if (null != thread)
+ {
+ thread.Join();
+ }
+
+ if (null != m_Mutex)
+ {
+ m_Mutex.Dispose();
+ }
+ }
+
+ return retVal;
+ }
+
+ public bool PosTest6()
+ {
+ bool retVal = true;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest6: Wait infinite time when another thread is in nondefault managed context");
+
+ try
+ {
+ m_Mutex = new Mutex();
+
+ thread = new Thread(new ThreadStart(CallContextBoundObjectMethod));
+ thread.Start();
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME / 5); // To avoid race
+ if (true != m_Mutex.WaitOne(Timeout.Infinite))
+ {
+ m_Mutex.ReleaseMutex();
+ TestLibrary.TestFramework.LogError("010", "WaitOne returns false when wait infinite time when another thread is in nondefault managed context");
+ retVal = false;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("011", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ // Wait for the thread to terminate
+ if (null != thread)
+ {
+ thread.Join();
+ }
+
+ if (null != m_Mutex)
+ {
+ m_Mutex.Dispose();
+ }
+ }
+
+ return retVal;
+ }
+
+ public bool PosTest7()
+ {
+ bool retVal = true;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest7: Wait infinite time when another thread is in nondefault managed context");
+
+ try
+ {
+ m_Mutex = new Mutex();
+
+ thread = new Thread(new ThreadStart(CallContextBoundObjectMethod));
+ thread.Start();
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME / 5); // To avoid race
+ if (true != m_Mutex.WaitOne(Timeout.Infinite))
+ {
+ m_Mutex.ReleaseMutex();
+ TestLibrary.TestFramework.LogError("012", "WaitOne returns false when wait infinite time when another thread is in nondefault managed context");
+ retVal = false;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("013", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ // Wait for the thread to terminate
+ if (null != thread)
+ {
+ thread.Join();
+ }
+
+ if (null != m_Mutex)
+ {
+ m_Mutex.Dispose();
+ }
+ }
+
+ return retVal;
+ }
+ #endregion
+
+ #region Negative Test Cases
+ public bool NegTest1()
+ {
+ bool retVal = true;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("NegTest1: AbandonedMutexException should be thrown if a thread exited without releasing a mutex");
+
+ try
+ {
+ m_Mutex = new Mutex();
+
+ thread = new Thread(new ThreadStart(NeverReleaseMutex));
+ thread.Start();
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME / 5); // To avoid race
+ m_Mutex.WaitOne(Timeout.Infinite);
+
+ // AbandonedMutexException is not thrown on Windows 98 or Windows ME
+ //if (Environment.OSVersion.Platform == PlatformID.Win32NT)
+ //{
+ TestLibrary.TestFramework.LogError("101", "AbandonedMutexException is not thrown if a thread exited without releasing a mutex");
+ retVal = false;
+ //}
+ }
+ catch (AbandonedMutexException)
+ {
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("102", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ if (null != thread)
+ {
+ thread.Join();
+ }
+
+ if (null != m_Mutex)
+ {
+ m_Mutex.Dispose();
+ }
+ }
+
+ return retVal;
+ }
+
+ public bool NegTest2()
+ {
+ bool retVal = true;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("NegTest2: ObjectDisposedException should be thrown if current instance has already been disposed");
+
+ try
+ {
+ m_Mutex = new Mutex();
+
+ thread = new Thread(new ThreadStart(DisposeMutex));
+ thread.Start();
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME / 5); // To avoid race
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME);
+ m_Mutex.WaitOne(Timeout.Infinite);
+
+ TestLibrary.TestFramework.LogError("103", "ObjectDisposedException is not thrown if current instance has already been disposed");
+ retVal = false;
+ }
+ catch (ObjectDisposedException)
+ {
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("104", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ if (null != thread)
+ {
+ thread.Join();
+ }
+
+ if (null != m_Mutex)
+ {
+ ((IDisposable)m_Mutex).Dispose();
+ }
+ }
+
+ return retVal;
+ }
+
+ public bool NegTest3()
+ {
+ bool retVal = true;
+ int testInt = 0;
+
+ TestLibrary.TestFramework.BeginScenario("NegTest3: Check ArgumentOutOfRangeException will be thrown if millisecondsTimeout is a negative number other than -1");
+
+ try
+ {
+ testInt = TestLibrary.Generator.GetInt32();
+
+ if (testInt > 0)
+ {
+ testInt = 0 - testInt;
+ }
+
+ if (testInt == -1)
+ {
+ testInt--;
+ }
+
+ m_Mutex = new Mutex();
+ m_Mutex.WaitOne(testInt);
+
+ TestLibrary.TestFramework.LogError("105", "ArgumentOutOfRangeException is not thrown if millisecondsTimeout is a negative number other than -1");
+ TestLibrary.TestFramework.LogInformation("[LOCAL VARIABLES] testInt = " + testInt);
+ retVal = false;
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("106", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation("[LOCAL VARIABLES] testInt = " + testInt);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ if (null != m_Mutex)
+ {
+ m_Mutex.Dispose();
+ }
+ }
+
+ return retVal;
+ }
+ #endregion
+ #endregion
+
+ public static int Main()
+ {
+ MutexWaitOne2 test = new MutexWaitOne2();
+
+ TestLibrary.TestFramework.BeginTestCase("MutexWaitOne2");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ #region Private Methods
+ private void SleepLongTime()
+ {
+ m_Mutex.WaitOne();
+ Thread.Sleep(c_LONG_SLEEP_TIME);
+ m_Mutex.ReleaseMutex();
+ }
+
+ private void SignalMutex()
+ {
+ m_Mutex.WaitOne();
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME);
+ m_Mutex.ReleaseMutex();
+ }
+
+ private void NeverReleaseMutex()
+ {
+ m_Mutex.WaitOne();
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME);
+ }
+
+ private void DisposeMutex()
+ {
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME);
+ ((IDisposable)m_Mutex).Dispose();
+ }
+
+ private void CallContextBoundObjectMethod()
+ {
+ m_Mutex.WaitOne();
+ TestContextBoundObject obj = new TestContextBoundObject();
+ obj.TestMethod();
+ m_Mutex.ReleaseMutex();
+ }
+ #endregion
+}
diff --git a/tests/src/baseservices/threading/mutex/misc/waitone2.csproj b/tests/src/baseservices/threading/mutex/misc/waitone2.csproj
new file mode 100644
index 0000000000..c6210da564
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/misc/waitone2.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitOne2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg1.cs b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg1.cs
new file mode 100644
index 0000000000..d14cff6915
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg1.cs
@@ -0,0 +1,38 @@
+// 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.Threading;
+
+class OpenMutexNeg
+{
+ public static int Main()
+ {
+ OpenMutexNeg omn = new OpenMutexNeg();
+ return omn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Mutex mut;
+ try
+ {
+ mut = Mutex.OpenExisting(Common.GetUniqueName());
+ }
+ catch (WaitHandleCannotBeOpenedException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg1.csproj b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg1.csproj
new file mode 100644
index 0000000000..b29bb89e3f
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg1.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="OpenMutexNeg1.cs" />
+ <Compile Include="..\OpenMutexCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg2.cs b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg2.cs
new file mode 100644
index 0000000000..5bc9a5a4cd
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg2.cs
@@ -0,0 +1,38 @@
+// 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.Threading;
+
+class OpenMutexNeg
+{
+ public static int Main()
+ {
+ OpenMutexNeg omn = new OpenMutexNeg();
+ return omn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Mutex mut;
+ try
+ {
+ mut = Mutex.OpenExisting("");
+ }
+ catch (ArgumentException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg2.csproj b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg2.csproj
new file mode 100644
index 0000000000..01e968c229
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg2.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="OpenMutexNeg2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg3.cs b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg3.cs
new file mode 100644
index 0000000000..734e0c4309
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg3.cs
@@ -0,0 +1,38 @@
+// 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.Threading;
+
+class OpenMutexNeg
+{
+ public static int Main()
+ {
+ OpenMutexNeg omn = new OpenMutexNeg();
+ return omn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Mutex mut;
+ try
+ {
+ mut = Mutex.OpenExisting(null);
+ }
+ catch (ArgumentNullException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg3.csproj b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg3.csproj
new file mode 100644
index 0000000000..be8e49552e
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg3.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="OpenMutexNeg3.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg4.cs b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg4.cs
new file mode 100644
index 0000000000..2511dcf996
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg4.cs
@@ -0,0 +1,39 @@
+// 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.Threading;
+
+class OpenMutexNeg
+{
+ public static int Main()
+ {
+ OpenMutexNeg omn = new OpenMutexNeg();
+ return omn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Mutex mut;
+ try
+ {
+ String myMut = null;
+ mut = Mutex.OpenExisting(myMut);
+ }
+ catch (ArgumentNullException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg4.csproj b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg4.csproj
new file mode 100644
index 0000000000..3bcc0665c2
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg4.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="OpenMutexNeg4.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg5.cs b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg5.cs
new file mode 100644
index 0000000000..0cd7db0cb1
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg5.cs
@@ -0,0 +1,40 @@
+// 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.Threading;
+
+class OpenMutexNeg
+{
+ public static int Main()
+ {
+ OpenMutexNeg omn = new OpenMutexNeg();
+ return omn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ string sName = Common.GetUniqueName();
+ // open a closed mutex
+ try
+ {
+ using (Mutex mut1 = new Mutex(false, sName)) {}
+ Mutex mut2 = Mutex.OpenExisting(sName);
+ }
+ catch (WaitHandleCannotBeOpenedException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg5.csproj b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg5.csproj
new file mode 100644
index 0000000000..3cd1dc1a10
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg5.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="OpenMutexNeg5.cs" />
+ <Compile Include="..\OpenMutexCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg6.cs b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg6.cs
new file mode 100644
index 0000000000..9979366f42
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg6.cs
@@ -0,0 +1,42 @@
+// 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.Threading;
+
+class OpenMutexNeg
+{
+ public static int Main()
+ {
+ OpenMutexNeg omn = new OpenMutexNeg();
+ return omn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ string sName = Common.GetUniqueName();
+ // open a Mutex with the same name as a Semaphore
+ using (Semaphore sem = new Semaphore(10, 10, sName))
+ {
+ try
+ {
+ Mutex mut = Mutex.OpenExisting(sName);
+ }
+ catch(WaitHandleCannotBeOpenedException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught exception where WaitHandleCannotBeOpenedException was expected: " +
+ e.ToString());
+ }
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg6.csproj b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg6.csproj
new file mode 100644
index 0000000000..2b29b766b1
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg6.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="OpenMutexNeg6.cs" />
+ <Compile Include="..\OpenMutexCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg7.cs b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg7.cs
new file mode 100644
index 0000000000..c4846141e8
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg7.cs
@@ -0,0 +1,59 @@
+// 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.Threading;
+
+class OpenMutexNeg
+{
+ public ManualResetEvent mre;
+ public Mutex mut;
+
+ public OpenMutexNeg()
+ {
+ mre = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ OpenMutexNeg omn = new OpenMutexNeg();
+ return omn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ string sName = Common.GetUniqueName();
+ // open a Mutex that has been abandoned
+ mut = new Mutex(false, sName);
+ Thread th = new Thread(new ParameterizedThreadStart(AbandonMutex));
+ th.Start(mut);
+ mre.WaitOne();
+ try
+ {
+ Mutex mut1 = Mutex.OpenExisting(sName);
+ mut1.WaitOne();
+ }
+ catch (AbandonedMutexException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutex(Object o)
+ {
+ ((Mutex)o).WaitOne();
+ mre.Set();
+ Thread.Sleep(1000);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg7.csproj b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg7.csproj
new file mode 100644
index 0000000000..6b4584fb5a
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg7.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="OpenMutexNeg7.cs" />
+ <Compile Include="..\OpenMutexCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.cs b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.cs
new file mode 100644
index 0000000000..ff47944833
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.cs
@@ -0,0 +1,41 @@
+// 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.Threading;
+
+class OpenMutexNeg
+{
+ public Mutex mut;
+
+ public static int Main()
+ {
+ OpenMutexNeg omn = new OpenMutexNeg();
+ return omn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ // open a Mutex, not case specific
+ mut = new Mutex(false, "This is a Mutex that is Case Specific");
+ try
+ {
+ Mutex mut1 = Mutex.OpenExisting("This is a Mutex that is Case specific");
+ }
+ catch (WaitHandleCannotBeOpenedException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.csproj b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.csproj
new file mode 100644
index 0000000000..ffe7672d6e
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="OpenMutexNeg8.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexpos1.cs b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos1.cs
new file mode 100644
index 0000000000..93f53a82bc
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos1.cs
@@ -0,0 +1,59 @@
+// 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.Threading;
+
+class OpenMutexPos
+{
+ Mutex mut;
+ ManualResetEvent mre;
+
+ public OpenMutexPos()
+ {
+ mre = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ OpenMutexPos omp = new OpenMutexPos();
+ return omp.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ string sName = Common.GetUniqueName();
+ // Basic test, not owned
+ using(mut = new Mutex(false, sName))
+ {
+ Thread t = new Thread(new ThreadStart(OwnMutex));
+ t.Start();
+ mre.WaitOne();
+ try
+ {
+ Mutex mut1 = Mutex.OpenExisting(sName);
+ mut1.WaitOne();
+ mut1.ReleaseMutex();
+ iRet = 100;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ ex.ToString());
+ }
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void OwnMutex()
+ {
+ mut.WaitOne();
+ mre.Set();
+ Thread.Sleep(3000);
+ mut.ReleaseMutex();
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexpos1.csproj b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos1.csproj
new file mode 100644
index 0000000000..4acd8848df
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos1.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="OpenMutexPos1.cs" />
+ <Compile Include="..\OpenMutexCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexpos2.cs b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos2.cs
new file mode 100644
index 0000000000..9581bdb517
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos2.cs
@@ -0,0 +1,46 @@
+// 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.Threading;
+
+class OpenMutexPos
+{
+ Mutex mut;
+ ManualResetEvent mre;
+
+ public OpenMutexPos()
+ {
+ mre = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ OpenMutexPos omp = new OpenMutexPos();
+ return omp.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ string sName = Common.GetUniqueName();
+ // Basic test, owned
+ using (mut = new Mutex(true, sName))
+ {
+ try
+ {
+ Mutex mut1 = Mutex.OpenExisting(sName);
+ iRet = 100;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ ex.ToString());
+ }
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexpos2.csproj b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos2.csproj
new file mode 100644
index 0000000000..8392fbd3a8
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos2.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="OpenMutexPos2.cs" />
+ <Compile Include="..\OpenMutexCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexpos3.cs b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos3.cs
new file mode 100644
index 0000000000..01abc0de33
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos3.cs
@@ -0,0 +1,48 @@
+// 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.Threading;
+
+class OpenMutexPos
+{
+ Mutex mut;
+
+ public static int Main()
+ {
+ OpenMutexPos omp = new OpenMutexPos();
+ return omp.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ string sName = Common.GetUniqueName();
+ // Open an abandoned mutex
+ using (mut = new Mutex(false, sName))
+ {
+ Thread t = new Thread(new ThreadStart(AbandonMutex));
+ t.Start();
+ t.Join();
+ try
+ {
+ Mutex mut1 = Mutex.OpenExisting(sName);
+ iRet = 100;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ ex.ToString());
+ }
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutex()
+ {
+ mut.WaitOne();
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexpos3.csproj b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos3.csproj
new file mode 100644
index 0000000000..94afd530e1
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos3.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="OpenMutexPos3.cs" />
+ <Compile Include="..\OpenMutexCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexpos4.cs b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos4.cs
new file mode 100644
index 0000000000..cf907d39a0
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos4.cs
@@ -0,0 +1,86 @@
+// 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.Threading;
+
+/// <summary>
+/// Verifies if we CreateMutex adn then OpenMutex we don't have ownership of the mutex.
+/// </summary>
+public class Test
+{
+ const string mutexName = "MySharedMutex";
+ static ManualResetEvent manualEvent = new ManualResetEvent(false);
+ static ManualResetEvent exitEvent = new ManualResetEvent(false);
+ int success = 100;
+
+
+ public void CreateMutexThread()
+ {
+ Console.WriteLine("Inside thread which creates a mutex");
+
+ Mutex mutex = new Mutex(true, mutexName);
+
+
+ Console.WriteLine("Mutex created");
+
+ manualEvent.Set();
+ mutex.ReleaseMutex();
+
+ exitEvent.WaitOne();
+ GC.KeepAlive(mutex);
+ }
+
+ public void ReuseMutexThread()
+ {
+ Console.WriteLine("Waiting to reuse mutex");
+ manualEvent.WaitOne();
+ bool exists;
+
+ Mutex mutex = new Mutex(true, mutexName, out exists);
+
+ if (exists)
+ {
+ Console.WriteLine("Error, created new mutex!");
+ success = 97;
+ }
+ else
+ {
+ mutex.WaitOne();
+ }
+
+
+ try
+ {
+ Console.WriteLine("Mutex reused {0}", exists);
+ mutex.ReleaseMutex();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Unexpected exception: {0}", e);
+ success = 98;
+ }
+
+ exitEvent.Set();
+ }
+
+ int RunTest()
+ {
+ Thread t1 = new Thread(new ThreadStart(CreateMutexThread));
+ Thread t2 = new Thread(new ThreadStart(ReuseMutexThread));
+ t1.Start();
+ t2.Start();
+ t1.Join();
+ t2.Join();
+
+ if (success == 100) Console.WriteLine("Test passed"); else Console.WriteLine("Test failed");
+ return (success);
+ }
+
+ public static int Main()
+ {
+ return (new Test().RunTest());
+ }
+}
+
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexpos4.csproj b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos4.csproj
new file mode 100644
index 0000000000..7925a85f92
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexpos4.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="OpenMutexPos4.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/mutex/openmutexcommon.cs b/tests/src/baseservices/threading/mutex/openmutexcommon.cs
new file mode 100644
index 0000000000..fce7fc3044
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openmutexcommon.cs
@@ -0,0 +1,32 @@
+// 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.Threading;
+
+class Common
+{
+ public static string GenerateUnicodeString(int iNumChars)
+ {
+ Random rand = new Random();
+ string semName = string.Empty;
+ string semNameNum = string.Empty;
+ for (int i = 0; i < iNumChars; i++)
+ {
+ char c = (char)rand.Next(Char.MinValue, Char.MaxValue);
+ semNameNum += ((int)c).ToString() + ";";
+ semName += (char)rand.Next(Char.MinValue, Char.MaxValue);
+ }
+ // write to output
+ Console.WriteLine("Unicode string: " + semNameNum);
+ return semName;
+ }
+
+ public static string GetUniqueName()
+ {
+ string sName = Guid.NewGuid().ToString();
+ Console.WriteLine("Name created: " + sName);
+ return sName;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartBool.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartBool.csproj
new file mode 100644
index 0000000000..e0396cbf54
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartBool.csproj
@@ -0,0 +1,43 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>false</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartbool.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartBool_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartBool_1.csproj
new file mode 100644
index 0000000000..25c4235c89
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartBool_1.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestProjectToRun>ThreadStartBool.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>true</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartByte.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartByte.csproj
new file mode 100644
index 0000000000..8f472a94d3
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartByte.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartbyte.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartByte_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartByte_1.csproj
new file mode 100644
index 0000000000..c06265ca4f
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartByte_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartByte.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartByte_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartByte_2.csproj
new file mode 100644
index 0000000000..31ed78afb5
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartByte_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartByte.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartCast.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartCast.csproj
new file mode 100644
index 0000000000..b02bcd7ea6
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartCast.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartcast.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartCast_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartCast_1.csproj
new file mode 100644
index 0000000000..94b36b3a09
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartCast_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartCast.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartCast_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartCast_2.csproj
new file mode 100644
index 0000000000..3dc399184a
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartCast_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartCast.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartChar.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartChar.csproj
new file mode 100644
index 0000000000..c0d429182f
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartChar.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartchar.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartChar_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartChar_1.csproj
new file mode 100644
index 0000000000..a422c77631
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartChar_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartChar.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>k</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartChar_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartChar_2.csproj
new file mode 100644
index 0000000000..28bcc4c56f
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartChar_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartChar.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>1234</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartChar_3.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartChar_3.csproj
new file mode 100644
index 0000000000..5cd5a1a70d
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartChar_3.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartChar.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartDecimal.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDecimal.csproj
new file mode 100644
index 0000000000..8854c85fc3
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDecimal.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartdecimal.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartDecimal_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDecimal_1.csproj
new file mode 100644
index 0000000000..9ccd38fa99
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDecimal_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartDecimal.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartDecimal_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDecimal_2.csproj
new file mode 100644
index 0000000000..5d85cca0f2
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDecimal_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartDecimal.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartDelegate.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDelegate.csproj
new file mode 100644
index 0000000000..1c529d4ec7
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDelegate.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartdelegate.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartDelegate_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDelegate_1.csproj
new file mode 100644
index 0000000000..c20e5fe2a9
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDelegate_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartDelegate.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartDelegate_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDelegate_2.csproj
new file mode 100644
index 0000000000..8f20029d3d
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDelegate_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartDelegate.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartDouble.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDouble.csproj
new file mode 100644
index 0000000000..ba3dbdf65a
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDouble.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartdouble.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartDouble_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDouble_1.csproj
new file mode 100644
index 0000000000..c7b47485c2
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDouble_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartDouble.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartDouble_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDouble_2.csproj
new file mode 100644
index 0000000000..8850e4645e
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartDouble_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartDouble.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartFloat.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartFloat.csproj
new file mode 100644
index 0000000000..1ccd317f30
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartFloat.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartfloat.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartFloat_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartFloat_1.csproj
new file mode 100644
index 0000000000..3f44019d27
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartFloat_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartFloat.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartFloat_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartFloat_2.csproj
new file mode 100644
index 0000000000..56ec2ace4d
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartFloat_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartFloat.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartGenerics.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartGenerics.csproj
new file mode 100644
index 0000000000..725abdac92
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartGenerics.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartgenerics.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartGenerics_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartGenerics_1.csproj
new file mode 100644
index 0000000000..eb3d2f7142
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartGenerics_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartGenerics.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartGenerics_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartGenerics_2.csproj
new file mode 100644
index 0000000000..40636d1c85
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartGenerics_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartGenerics.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartInt.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartInt.csproj
new file mode 100644
index 0000000000..899d192fb8
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartInt.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartint.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartInt_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartInt_1.csproj
new file mode 100644
index 0000000000..909b0e3463
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartInt_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartInt.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartInt_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartInt_2.csproj
new file mode 100644
index 0000000000..2fc1f23f19
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartInt_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartInt.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartLong.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartLong.csproj
new file mode 100644
index 0000000000..d83fea5dca
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartLong.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartlong.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartLong_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartLong_1.csproj
new file mode 100644
index 0000000000..71f3f64083
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartLong_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartLong.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartLong_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartLong_2.csproj
new file mode 100644
index 0000000000..a9a3df2772
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartLong_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartLong.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartNeg1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartNeg1.csproj
new file mode 100644
index 0000000000..f1c784399d
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartNeg1.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartneg1.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartNeg3.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartNeg3.csproj
new file mode 100644
index 0000000000..7d251eb337
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartNeg3.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartneg3.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartNeg4.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartNeg4.csproj
new file mode 100644
index 0000000000..1c0e68d151
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartNeg4.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartneg4.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartNull.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartNull.csproj
new file mode 100644
index 0000000000..88aa57ff4b
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartNull.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartnull.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartNull2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartNull2.csproj
new file mode 100644
index 0000000000..a7a19f7b58
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartNull2.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartnull2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartObject.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartObject.csproj
new file mode 100644
index 0000000000..06662b9bbf
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartObject.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>""</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartobject.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartObject_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartObject_1.csproj
new file mode 100644
index 0000000000..8cad1cfe83
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartObject_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartObject.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>MyObject</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartObject_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartObject_2.csproj
new file mode 100644
index 0000000000..07c71ce07c
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartObject_2.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartObject.csproj</CLRTestProjectToRun>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartOperations.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartOperations.csproj
new file mode 100644
index 0000000000..fd0477e705
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartOperations.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartoperations.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartOperations_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartOperations_1.csproj
new file mode 100644
index 0000000000..f656be856c
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartOperations_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartOperations.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartOperations_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartOperations_2.csproj
new file mode 100644
index 0000000000..701156a0da
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartOperations_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartOperations.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartSByte.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartSByte.csproj
new file mode 100644
index 0000000000..2b3f2b8c80
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartSByte.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartsbyte.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartSByte_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartSByte_1.csproj
new file mode 100644
index 0000000000..4363ea3d12
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartSByte_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartSByte.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartSByte_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartSByte_2.csproj
new file mode 100644
index 0000000000..1fd07b5bef
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartSByte_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartSByte.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartShort.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartShort.csproj
new file mode 100644
index 0000000000..6234e2efe5
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartShort.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartshort.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartShort_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartShort_1.csproj
new file mode 100644
index 0000000000..535bf0c64a
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartShort_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartShort.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartShort_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartShort_2.csproj
new file mode 100644
index 0000000000..a538a37744
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartShort_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartShort.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartString.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartString.csproj
new file mode 100644
index 0000000000..f6621851e0
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartString.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>MyStringHere</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartstring.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartString_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartString_1.csproj
new file mode 100644
index 0000000000..6ddbafbb21
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartString_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartString.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>" "</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartString_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartString_2.csproj
new file mode 100644
index 0000000000..29028f7063
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartString_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartString.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>""</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartString_3.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartString_3.csproj
new file mode 100644
index 0000000000..f8bfbaaf3d
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartString_3.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartString.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>null</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartUInt.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartUInt.csproj
new file mode 100644
index 0000000000..508831de6d
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartUInt.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartuint.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartUInt_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartUInt_1.csproj
new file mode 100644
index 0000000000..6e87da1910
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartUInt_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartUInt.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartUInt_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartUInt_2.csproj
new file mode 100644
index 0000000000..7d909352df
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartUInt_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartUInt.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartULong.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartULong.csproj
new file mode 100644
index 0000000000..d07cc9c1e7
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartULong.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartulong.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartULong_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartULong_1.csproj
new file mode 100644
index 0000000000..98022c5992
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartULong_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartULong.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartULong_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartULong_2.csproj
new file mode 100644
index 0000000000..e68810fb07
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartULong_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartULong.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartUShort.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartUShort.csproj
new file mode 100644
index 0000000000..e5406ee4dc
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartUShort.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestExecutionArguments>max</CLRTestExecutionArguments>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstartushort.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartUShort_1.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartUShort_1.csproj
new file mode 100644
index 0000000000..d37195bae6
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartUShort_1.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartUShort.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>min</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/ThreadStartUShort_2.csproj b/tests/src/baseservices/threading/paramthreadstart/ThreadStartUShort_2.csproj
new file mode 100644
index 0000000000..db3365c539
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/ThreadStartUShort_2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLRTestKind>RunOnly</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestProjectToRun>ThreadStartUShort.csproj</CLRTestProjectToRun>
+ <CLRTestExecutionArguments>0</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartarray.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartarray.cs
new file mode 100644
index 0000000000..30f9074b4f
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartarray.cs
@@ -0,0 +1,58 @@
+// 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.Threading;
+
+class ThreadStartArray
+{
+ Mutex[] m;
+ AutoResetEvent are = new AutoResetEvent(false);
+
+ public static int Main()
+ {
+ // Abandon this mutex
+ Mutex[] mArr = new Mutex[64];
+ for(int i=0;i<mArr.Length;i++)
+ mArr[i] = new Mutex(false);
+
+ ThreadStartArray tsa = new ThreadStartArray();
+ return tsa.Run(mArr);
+ }
+
+ private int Run(Mutex[] mPass)
+ {
+ bool bRet = false;
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(mPass);
+ are.WaitOne();
+
+ // Check to make sure the array is abandoned
+ try
+ {
+ WaitHandle.WaitAny(m, 10000);
+ }
+ catch(AbandonedMutexException)
+ {
+ bRet = true;
+ }
+ catch(Exception ex)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + ex.ToString());
+ }
+
+ Console.WriteLine(bRet ? "Test Passed" : "Test Failed");
+ return (bRet ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ for(int i = 0;i<((Mutex[])o).Length;i++)
+ ((Mutex[])o)[i].WaitOne();
+
+ m = (Mutex[])o;
+ are.Set();
+ Thread.Sleep(1000);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartarray.csproj b/tests/src/baseservices/threading/paramthreadstart/threadstartarray.csproj
new file mode 100644
index 0000000000..afbf28f535
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartarray.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ThreadStartArray.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartbool.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartbool.cs
new file mode 100644
index 0000000000..557d710977
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartbool.cs
@@ -0,0 +1,38 @@
+// 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.Threading;
+
+class ThreadStartBool
+{
+ bool b = false;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartBool <bool>\n");
+ return -1;
+ }
+
+ ThreadStartBool tsb = new ThreadStartBool();
+ return tsb.Run(Convert.ToBoolean(args[0]));
+ }
+
+ private int Run(bool bPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(bPass);
+ t.Join();
+ Console.WriteLine(b == bPass ? "Test Passed" : "Test Failed");
+ return (b == bPass ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ b = (bool)o;
+ Console.WriteLine(b);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartbyte.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartbyte.cs
new file mode 100644
index 0000000000..ec90c23631
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartbyte.cs
@@ -0,0 +1,47 @@
+// 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.Threading;
+
+class ThreadStartByte
+{
+ byte iByte = 0x0;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartByte <int>|min|max\n");
+ return -1;
+ }
+
+ byte b = 0x0;
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ b = Byte.MaxValue;
+ else if(args[0].ToLower() == "min")
+ b = Byte.MinValue;
+ else
+ b = Convert.ToByte(args[0]);
+
+ ThreadStartByte tsb = new ThreadStartByte();
+ return tsb.Run(b);
+ }
+
+ private int Run(byte bPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(bPass);
+ t.Join();
+ Console.WriteLine(iByte == bPass ? "Test Passed" : "Test Failed");
+ return (iByte == bPass ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ iByte = (byte)o;
+ Console.WriteLine(iByte);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartcast.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartcast.cs
new file mode 100644
index 0000000000..3933931ac9
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartcast.cs
@@ -0,0 +1,48 @@
+// 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.Threading;
+
+class ThreadStartInt
+{
+ object num;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartInt <int>|min|max\n");
+ return -1;
+ }
+
+ int i = 0;
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ i = Int32.MaxValue;
+ else if(args[0].ToLower() == "min")
+ i = Int32.MinValue;
+ else
+ i = Convert.ToInt32(args[0]);
+
+ ThreadStartInt tsi = new ThreadStartInt();
+ return tsi.Run(i);
+ }
+
+ private int Run(int iPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(Convert.ToDouble(iPass));
+ t.Join();
+ bool bRet = (double)num == (double)iPass;
+ Console.WriteLine(bRet ? "Test Passed" : "Test Failed");
+ return (bRet ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ num = o;
+ Console.WriteLine(num);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartchar.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartchar.cs
new file mode 100644
index 0000000000..2cc017133e
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartchar.cs
@@ -0,0 +1,49 @@
+// 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.Threading;
+
+class ThreadStartChar
+{
+ char c = 'c';
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartChar <char>|int\n");
+ return -1;
+ }
+
+ char cToPass = 'c';
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ cToPass = Char.MaxValue;
+ else if(args[0].ToLower() == "min")
+ cToPass = Char.MinValue;
+ // check if it is a char or an int
+ else if(args[0].Length > 1)
+ cToPass = Convert.ToChar(Convert.ToInt32(args[0]));
+ else
+ cToPass = Convert.ToChar(args[0]);
+ ThreadStartChar tss = new ThreadStartChar();
+ return tss.Run(cToPass);
+ }
+
+ private int Run(char cPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(cPass);
+ t.Join();
+ Console.WriteLine(c == cPass ? "Test Passed" : "Test Failed");
+ return (c == cPass ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ c = (char)o;
+ Console.WriteLine(c);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartclass.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartclass.cs
new file mode 100644
index 0000000000..e3667b04b2
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartclass.cs
@@ -0,0 +1,52 @@
+// 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.Threading;
+using System.Diagnostics;
+
+class ThreadStartClass
+{
+ Object oSaved = null;
+
+ public static int Main(string[] args)
+ {
+ ThreadStartClass tsc = new ThreadStartClass();
+ return tsc.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = 100;
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ Thread.Sleep(1000);
+ sw.Stop();
+
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(sw);
+ t.Join();
+
+ if (sw.ElapsedMilliseconds != ((Stopwatch)oSaved).ElapsedMilliseconds)
+ {
+ Console.WriteLine("Expected ((Stopwatch)oSaved).ElapsedMilliseconds = sw.ElapsedMilliseconds=" + sw.ElapsedMilliseconds.ToString());
+ Console.WriteLine("Actual oSaved.ElapsedMilliseconds=" + ((Stopwatch)oSaved).ElapsedMilliseconds.ToString());
+ iRet = 98;
+ }
+ Console.WriteLine("Expected ((Stopwatch)oSaved).ElapsedMilliseconds to be 1000, but found " + ((Stopwatch)oSaved).ElapsedMilliseconds);
+ if (((Stopwatch)oSaved).ElapsedMilliseconds < 950)
+ {
+ Console.WriteLine("Expected ((Stopwatch)oSaved).ElapsedMilliseconds to be 1000, but found " + ((Stopwatch)oSaved).ElapsedMilliseconds);
+ iRet = 97;
+ }
+
+ Console.WriteLine(iRet==100 ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ oSaved = o;
+ }
+}
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartclass.csproj b/tests/src/baseservices/threading/paramthreadstart/threadstartclass.csproj
new file mode 100644
index 0000000000..48ca36cc61
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartclass.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ThreadStartClass.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartdecimal.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartdecimal.cs
new file mode 100644
index 0000000000..0773f21c59
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartdecimal.cs
@@ -0,0 +1,46 @@
+// 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.Threading;
+
+class ThreadStartDecimal
+{
+ decimal dNum = 0M;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartDouble <decimal>|min|max\n");
+ return -1;
+ }
+
+ decimal d = 0M;
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ d = Decimal.MaxValue;
+ else if(args[0].ToLower() == "min")
+ d = Decimal.MinValue;
+ else
+ d = Convert.ToDecimal(args[0]);
+ ThreadStartDecimal tsd = new ThreadStartDecimal();
+ return tsd.Run(d);
+ }
+
+ private int Run(decimal dPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(dPass);
+ t.Join();
+ Console.WriteLine(dNum == dPass ? "Test Passed" : "Test Failed");
+ return (dNum == dPass ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ dNum = (decimal)o;
+ Console.WriteLine(dNum);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartdelegate.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartdelegate.cs
new file mode 100644
index 0000000000..3bb10ede54
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartdelegate.cs
@@ -0,0 +1,60 @@
+// 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.Threading;
+
+public delegate string myMethodDelegate(int myInt);
+
+class MyDelClass
+{
+ public string Show(int myInt)
+ {
+ Console.WriteLine(myInt);
+ return myInt.ToString();
+ }
+}
+
+class ThreadStartGen
+{
+ string num = string.Empty;
+ static int iSet = 0;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartInt <int>|min|max\n");
+ return -1;
+ }
+
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ iSet = Int32.MaxValue;
+ else if(args[0].ToLower() == "min")
+ iSet = Int32.MinValue;
+ else
+ iSet = Convert.ToInt32(args[0]);
+
+ ThreadStartGen tsg = new ThreadStartGen();
+ return tsg.Run();
+ }
+
+ private int Run()
+ {
+ MyDelClass mdc = new MyDelClass();
+ myMethodDelegate md1 = new myMethodDelegate(mdc.Show);
+
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(md1);
+ t.Join();
+ Console.WriteLine(iSet.ToString() == num ? "Test Passed" : "Test Failed");
+ return (iSet.ToString() == num ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ num = ((myMethodDelegate)o)(iSet);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartdouble.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartdouble.cs
new file mode 100644
index 0000000000..ffca086298
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartdouble.cs
@@ -0,0 +1,71 @@
+// 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.Threading;
+
+class ThreadStartDouble
+{
+ double dNum = 0D;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartDouble <double>" +
+ "|min|max|pi|nan|negi|posi\n");
+ return -1;
+ }
+
+ double d = 0D;
+ // check for special cases
+ switch(args[0].ToLower())
+ {
+ case "max":
+ d = Double.MaxValue;
+ break;
+ case "min":
+ d = Double.MinValue;
+ break;
+ case "pi":
+ d = Math.PI;
+ break;
+ case "nan":
+ d = Double.NaN;
+ break;
+ case "negi":
+ d = Double.NegativeInfinity;
+ break;
+ case "posi":
+ d = Double.PositiveInfinity;
+ break;
+ default:
+ d = Convert.ToDouble(args[0]);
+ break;
+ }
+ ThreadStartDouble tsd = new ThreadStartDouble();
+ return tsd.Run(d);
+ }
+
+ private int Run(double dPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(dPass);
+ t.Join();
+
+ bool bRet = false;
+ if(Double.IsNaN(dPass))
+ bRet = Double.IsNaN(dNum);
+ else
+ bRet = dNum == dPass;
+ Console.WriteLine(bRet ? "Test Passed" : "Test Failed");
+ return (bRet ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ dNum = (double)o;
+ Console.WriteLine(dNum);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartfloat.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartfloat.cs
new file mode 100644
index 0000000000..516033ad4d
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartfloat.cs
@@ -0,0 +1,46 @@
+// 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.Threading;
+
+class ThreadStartFloat
+{
+ float fNum = 0F;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartFloat <float>|min|max\n");
+ return -1;
+ }
+
+ float f = 0F;
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ f = Single.MaxValue;
+ else if(args[0].ToLower() == "min")
+ f = Single.MinValue;
+ else
+ f = Convert.ToSingle(args[0]);
+ ThreadStartFloat tsf = new ThreadStartFloat();
+ return tsf.Run(f);
+ }
+
+ private int Run(float fPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(fPass);
+ t.Join();
+ Console.WriteLine(fNum == fPass ? "Test Passed" : "Test Failed");
+ return (fNum == fPass ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ fNum = (float)o;
+ Console.WriteLine(fNum);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartgenerics.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartgenerics.cs
new file mode 100644
index 0000000000..a55d7115ca
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartgenerics.cs
@@ -0,0 +1,57 @@
+// 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.Threading;
+
+class MyGenClass<ItemType>
+{
+ public void Show(ItemType myType, out ItemType outType)
+ {
+ Console.WriteLine(myType);
+ outType = myType;
+ }
+}
+
+class ThreadStartGen
+{
+ int iNum = 0;
+ static int iSet = 0;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartInt <int>|min|max\n");
+ return -1;
+ }
+
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ iSet = Int32.MaxValue;
+ else if(args[0].ToLower() == "min")
+ iSet = Int32.MinValue;
+ else
+ iSet = Convert.ToInt32(args[0]);
+
+ ThreadStartGen tsg = new ThreadStartGen();
+ return tsg.Run();
+ }
+
+ private int Run()
+ {
+ MyGenClass<int> myObj1 = new MyGenClass<int>();
+
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(myObj1);
+ t.Join();
+ Console.WriteLine(iSet == iNum ? "Test Passed" : "Test Failed");
+ return (iSet == iNum ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ ((MyGenClass<int>)o).Show(iSet, out iNum);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartint.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartint.cs
new file mode 100644
index 0000000000..93fb71791b
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartint.cs
@@ -0,0 +1,47 @@
+// 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.Threading;
+
+class ThreadStartInt
+{
+ int iNum = 0;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartInt <int>|min|max\n");
+ return -1;
+ }
+
+ int i = 0;
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ i = Int32.MaxValue;
+ else if(args[0].ToLower() == "min")
+ i = Int32.MinValue;
+ else
+ i = Convert.ToInt32(args[0]);
+
+ ThreadStartInt tsi = new ThreadStartInt();
+ return tsi.Run(i);
+ }
+
+ private int Run(int iPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(iPass);
+ t.Join();
+ Console.WriteLine(iNum == iPass ? "Test Passed" : "Test Failed");
+ return (iNum == iPass ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ iNum = (int)o;
+ Console.WriteLine(iNum);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartlong.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartlong.cs
new file mode 100644
index 0000000000..e6af71dc17
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartlong.cs
@@ -0,0 +1,47 @@
+// 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.Threading;
+
+class ThreadStartLong
+{
+ long lNum = 0;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartLong <long>|min|max\n");
+ return -1;
+ }
+
+ long l = 0;
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ l = Int64.MaxValue;
+ else if(args[0].ToLower() == "min")
+ l = Int64.MinValue;
+ else
+ l = Convert.ToInt64(args[0]);
+
+ ThreadStartLong tsl = new ThreadStartLong();
+ return tsl.Run(l);
+ }
+
+ private int Run(long lPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(lPass);
+ t.Join();
+ Console.WriteLine(lNum == lPass ? "Test Passed" : "Test Failed");
+ return (lNum == lPass ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ lNum = (long)o;
+ Console.WriteLine(lNum);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartneg1.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartneg1.cs
new file mode 100644
index 0000000000..9f4ba2763a
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartneg1.cs
@@ -0,0 +1,43 @@
+// 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.Threading;
+
+class ThreadStartInt
+{
+ public static int Main()
+ {
+ ThreadStartInt tsi = new ThreadStartInt();
+ return tsi.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(12345);
+ try
+ {
+ t.Start(12345);
+ }
+ catch(ThreadStateException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception ex)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + ex.ToString());
+ }
+ t.Join();
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ Console.WriteLine(o);
+ Thread.Sleep(1000);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartneg3.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartneg3.cs
new file mode 100644
index 0000000000..efe1a66f7e
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartneg3.cs
@@ -0,0 +1,45 @@
+// 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.Threading;
+
+class ThreadStartNeg
+{
+ ManualResetEvent mre = new ManualResetEvent(false);
+
+ public static int Main()
+ {
+ ThreadStartNeg tsn = new ThreadStartNeg();
+ return tsn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+
+ try
+ {
+ Thread t = new Thread(new ThreadStart(ThreadWorker));
+ t.Start(0);
+ Console.WriteLine("Thread failed to throw an exception!");
+ }
+ catch(InvalidOperationException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception ex)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + ex.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void ThreadWorker()
+ {
+ Console.WriteLine("In ThreadWorker");
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartneg4.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartneg4.cs
new file mode 100644
index 0000000000..09c67d304d
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartneg4.cs
@@ -0,0 +1,36 @@
+// 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.Threading;
+
+class ThreadStartInt
+{
+ public static int Main()
+ {
+ ThreadStartInt tsi = new ThreadStartInt();
+ return tsi.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ try
+ {
+ Thread t = new Thread((ParameterizedThreadStart)null);
+ t.Start(12345);
+ Console.WriteLine("No exception thrown!");
+ }
+ catch(ArgumentNullException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception ex)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + ex.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartnull.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartnull.cs
new file mode 100644
index 0000000000..3b4564c5e4
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartnull.cs
@@ -0,0 +1,33 @@
+// 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.Threading;
+
+class ThreadStartNull
+{
+ int iRet = -1;
+
+ public static int Main()
+ {
+ ThreadStartNull tsn = new ThreadStartNull();
+ return tsn.Run();
+ }
+
+ private int Run()
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(null);
+ t.Join();
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ if(null == o)
+ iRet = 100;
+ else
+ Console.WriteLine("Object was not null");
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartnull2.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartnull2.cs
new file mode 100644
index 0000000000..d81683c0fd
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartnull2.cs
@@ -0,0 +1,34 @@
+// 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.Threading;
+
+class ThreadStartNull
+{
+ int iRet = -1;
+
+ public static int Main()
+ {
+ ThreadStartNull tsn = new ThreadStartNull();
+ return tsn.Run();
+ }
+
+ private int Run()
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ // test passing no variable passes null
+ t.Start();
+ t.Join();
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ if(null == o)
+ iRet = 100;
+ else
+ Console.WriteLine("Object was not null");
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartobject.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartobject.cs
new file mode 100644
index 0000000000..24f306c577
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartobject.cs
@@ -0,0 +1,38 @@
+// 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.Threading;
+
+class ThreadStartObject
+{
+ object o = null;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartObject <object>|min|max\n");
+ return -1;
+ }
+
+ ThreadStartObject tso = new ThreadStartObject();
+ return tso.Run(args[0]);
+ }
+
+ private int Run(object oPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(oPass);
+ t.Join();
+ Console.WriteLine(o == oPass ? "Test Passed" : "Test Failed");
+ return (o == oPass ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object oPassed)
+ {
+ o = oPassed;
+ Console.WriteLine(o);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartoperations.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartoperations.cs
new file mode 100644
index 0000000000..f8b7213adc
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartoperations.cs
@@ -0,0 +1,81 @@
+// 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.Threading;
+
+class ThreadStartInt
+{
+ int iNum = 0;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartInt <int>|min|max\n");
+ return -1;
+ }
+
+ int i = 0;
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ i = Int32.MaxValue;
+ else if(args[0].ToLower() == "min")
+ i = Int32.MinValue;
+ else
+ i = Convert.ToInt32(args[0]);
+
+ ThreadStartInt tsi = new ThreadStartInt();
+ if(tsi.RunAdd(i) && tsi.RunSub(i) && tsi.RunMult(i) && tsi.RunDiv(i))
+ return 100;
+ else
+ return -1;
+ }
+
+ private bool RunAdd(int iPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(
+ ThreadWorker));
+ t.Start(iPass + iPass);
+ t.Join();
+ Console.WriteLine(iNum == iPass*2 ? "Test Passed" : "Test Failed");
+ return (iNum == iPass*2);
+ }
+
+ private bool RunSub(int iPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(
+ ThreadWorker));
+ t.Start(iPass - iPass);
+ t.Join();
+ Console.WriteLine(0 == iNum ? "Test Passed" : "Test Failed");
+ return (0 == iNum);
+ }
+
+ private bool RunMult(int iPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(
+ ThreadWorker));
+ t.Start(iPass * 10);
+ t.Join();
+ Console.WriteLine(iPass*10 == iNum ? "Test Passed" : "Test Failed");
+ return (iPass*10 == iNum);
+ }
+
+ private bool RunDiv(int iPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(
+ ThreadWorker));
+ t.Start(iPass/10);
+ t.Join();
+ Console.WriteLine(iPass/10 == iNum ? "Test Passed" : "Test Failed");
+ return (iPass/10 == iNum);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ iNum = (int)o;
+ Console.WriteLine(iNum);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartsbyte.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartsbyte.cs
new file mode 100644
index 0000000000..0eb178acbb
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartsbyte.cs
@@ -0,0 +1,47 @@
+// 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.Threading;
+
+class ThreadStartSByte
+{
+ sbyte iByte = 0x0;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartSByte <int>|min|max\n");
+ return -1;
+ }
+
+ sbyte b = 0x0;
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ b = SByte.MaxValue;
+ else if(args[0].ToLower() == "min")
+ b = SByte.MinValue;
+ else
+ b = Convert.ToSByte(args[0]);
+
+ ThreadStartSByte tsb = new ThreadStartSByte();
+ return tsb.Run(b);
+ }
+
+ private int Run(sbyte bPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(bPass);
+ t.Join();
+ Console.WriteLine(iByte == bPass ? "Test Passed" : "Test Failed");
+ return (iByte == bPass ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ iByte = (sbyte)o;
+ Console.WriteLine(iByte);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartshort.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartshort.cs
new file mode 100644
index 0000000000..13f29da03c
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartshort.cs
@@ -0,0 +1,47 @@
+// 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.Threading;
+
+class ThreadStartShort
+{
+ short sNum = 0;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartShort <short>|min|max\n");
+ return -1;
+ }
+
+ short s = 0;
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ s = Int16.MaxValue;
+ else if(args[0].ToLower() == "min")
+ s = Int16.MinValue;
+ else
+ s = Convert.ToInt16(args[0]);
+
+ ThreadStartShort tss = new ThreadStartShort();
+ return tss.Run(s);
+ }
+
+ private int Run(short sPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(sPass);
+ t.Join();
+ Console.WriteLine(sNum == sPass ? "Test Passed" : "Test Failed");
+ return (sNum == sPass ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ sNum = (short)o;
+ Console.WriteLine(sNum);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartstring.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartstring.cs
new file mode 100644
index 0000000000..bc19bd266d
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartstring.cs
@@ -0,0 +1,44 @@
+// 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.Threading;
+
+class ThreadStartString
+{
+ string s = string.Empty;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartString <string>|null\n");
+ return -1;
+ }
+
+ string sToPass = string.Empty;
+ if(args[0].ToLower() == "null")
+ sToPass = null;
+ else
+ sToPass = args[0];
+
+ ThreadStartString tss = new ThreadStartString();
+ return tss.Run(sToPass);
+ }
+
+ private int Run(string sPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(sPass);
+ t.Join();
+ Console.WriteLine(s == sPass ? "Test Passed" : "Test Failed");
+ return (s == sPass ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ s = (string)o;
+ Console.WriteLine(s);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartstruct.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartstruct.cs
new file mode 100644
index 0000000000..f6e5e54725
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartstruct.cs
@@ -0,0 +1,67 @@
+// 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.Threading;
+
+class ThreadStartStruct
+{
+ int iRet = -1;
+
+ public struct MyStruct
+ {
+ public int myInt;
+ public string myStr;
+ public long myLong;
+ public double myDouble;
+ public Mutex myMutex;
+ }
+
+ public static int Main()
+ {
+ ThreadStartStruct tss = new ThreadStartStruct();
+ return tss.Run();
+ }
+
+ private int Run()
+ {
+ MyStruct m = new MyStruct();
+ m.myInt = Int32.MinValue;
+ m.myStr = "This is the string";
+ m.myLong = Int64.MaxValue;
+ m.myDouble = Double.MinValue;
+ m.myMutex = new Mutex(true);
+
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(m);
+ // Test to see if it passing an owned mutex
+ Thread.Sleep(1000);
+ m.myMutex.ReleaseMutex();
+ t.Join();
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return (100 == iRet ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ if(Int32.MinValue == ((MyStruct)o).myInt &&
+ "This is the string" == ((MyStruct)o).myStr &&
+ Int64.MaxValue == ((MyStruct)o).myLong &&
+ Double.MinValue == ((MyStruct)o).myDouble)
+ {
+ try
+ {
+ ((MyStruct)o).myMutex.WaitOne();
+ ((MyStruct)o).myMutex.ReleaseMutex();
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartstruct.csproj b/tests/src/baseservices/threading/paramthreadstart/threadstartstruct.csproj
new file mode 100644
index 0000000000..94bb38b9a7
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartstruct.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ThreadStartStruct.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartuint.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartuint.cs
new file mode 100644
index 0000000000..c73ee4f591
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartuint.cs
@@ -0,0 +1,47 @@
+// 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.Threading;
+
+class ThreadStartUInt
+{
+ uint iNum = 0;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartUInt <uint>|min|max\n");
+ return -1;
+ }
+
+ uint i = 0;
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ i = UInt32.MaxValue;
+ else if(args[0].ToLower() == "min")
+ i = UInt32.MinValue;
+ else
+ i = Convert.ToUInt32(args[0]);
+
+ ThreadStartUInt tsu = new ThreadStartUInt();
+ return tsu.Run(i);
+ }
+
+ private int Run(uint iPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(iPass);
+ t.Join();
+ Console.WriteLine(iNum == iPass ? "Test Passed" : "Test Failed");
+ return (iNum == iPass ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ iNum = (uint)o;
+ Console.WriteLine(iNum);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartulong.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartulong.cs
new file mode 100644
index 0000000000..f6000f1032
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartulong.cs
@@ -0,0 +1,47 @@
+// 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.Threading;
+
+class ThreadStartULong
+{
+ ulong lNum = 0;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartULong <ulong>|min|max\n");
+ return -1;
+ }
+
+ ulong l = 0;
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ l = UInt64.MaxValue;
+ else if(args[0].ToLower() == "min")
+ l = UInt64.MinValue;
+ else
+ l = Convert.ToUInt64(args[0]);
+
+ ThreadStartULong tsl = new ThreadStartULong();
+ return tsl.Run(l);
+ }
+
+ private int Run(ulong lPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(lPass);
+ t.Join();
+ Console.WriteLine(lNum == lPass ? "Test Passed" : "Test Failed");
+ return (lNum == lPass ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ lNum = (ulong)o;
+ Console.WriteLine(lNum);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/paramthreadstart/threadstartushort.cs b/tests/src/baseservices/threading/paramthreadstart/threadstartushort.cs
new file mode 100644
index 0000000000..7d739fc182
--- /dev/null
+++ b/tests/src/baseservices/threading/paramthreadstart/threadstartushort.cs
@@ -0,0 +1,47 @@
+// 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.Threading;
+
+class ThreadStartUShort
+{
+ ushort sNum = 0;
+
+ public static int Main(string[] args)
+ {
+ // check args
+ if(args.Length != 1)
+ {
+ Console.WriteLine("USAGE: ThreadStartUShort <ushort>|min|max\n");
+ return -1;
+ }
+
+ ushort s = 0;
+ // check for max or min
+ if(args[0].ToLower() == "max")
+ s = UInt16.MaxValue;
+ else if(args[0].ToLower() == "min")
+ s = UInt16.MinValue;
+ else
+ s = Convert.ToUInt16(args[0]);
+
+ ThreadStartUShort tss = new ThreadStartUShort();
+ return tss.Run(s);
+ }
+
+ private int Run(ushort sPass)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));
+ t.Start(sPass);
+ t.Join();
+ Console.WriteLine(sNum == sPass ? "Test Passed" : "Test Failed");
+ return (sNum == sPass ? 100 : -1);
+ }
+
+ private void ThreadWorker(Object o)
+ {
+ sNum = (ushort)o;
+ Console.WriteLine(sNum);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/13662/13662-a.cs b/tests/src/baseservices/threading/regressions/13662/13662-a.cs
new file mode 100644
index 0000000000..c3f5d0fd87
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/13662/13662-a.cs
@@ -0,0 +1,33 @@
+// 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.Threading;
+
+
+public class Test {
+
+ public static int Main(){
+
+ int rValue = 100;
+ Timer[] tArray = new Timer[1000];
+ int val = 0;
+ while(val < 10){
+ Interlocked.Increment(ref val);
+ Console.WriteLine("Loop {0}",val);
+ for(int i = 0;i<tArray.Length;i++)
+ tArray[i] = new Timer(new TimerCallback(TFunc),0,1000,100000);
+
+ Thread.Sleep(1000);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ }
+ return rValue;
+ }
+
+ public static void TFunc(Object o)
+ {
+ Thread.Sleep(1);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/13662/13662-a.csproj b/tests/src/baseservices/threading/regressions/13662/13662-a.csproj
new file mode 100644
index 0000000000..8e256b8fb5
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/13662/13662-a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="13662-a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/13662/13662-b.cs b/tests/src/baseservices/threading/regressions/13662/13662-b.cs
new file mode 100644
index 0000000000..1e7a4d9936
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/13662/13662-b.cs
@@ -0,0 +1,89 @@
+// 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.Threading;
+
+
+public class Test {
+
+ public static int Main(){
+
+ int rValue = 100;
+ Timer[] tArray = new Timer[1000];
+ for(int i = 0;i<tArray.Length;i++)
+ tArray[i] = new Timer(new TimerCallback(TFunc),0,1000,100000);
+
+ Thread.Sleep(1000);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ for(int i = 0;i<tArray.Length;i++)
+ tArray[i] = new Timer(new TimerCallback(TFunc),0,1000,100000);
+
+ Thread.Sleep(1000);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ for(int i = 0;i<tArray.Length;i++)
+ tArray[i] = new Timer(new TimerCallback(TFunc),0,1000,100000);
+
+ Thread.Sleep(1000);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ for(int i = 0;i<tArray.Length;i++)
+ tArray[i] = new Timer(new TimerCallback(TFunc),0,1000,100000);
+
+ Thread.Sleep(1000);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ for(int i = 0;i<tArray.Length;i++)
+ tArray[i] = new Timer(new TimerCallback(TFunc),0,1000,100000);
+
+ Thread.Sleep(1000);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ for(int i = 0;i<tArray.Length;i++)
+ tArray[i] = new Timer(new TimerCallback(TFunc),0,1000,100000);
+
+ Thread.Sleep(1000);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ for(int i = 0;i<tArray.Length;i++)
+ tArray[i] = new Timer(new TimerCallback(TFunc),0,1000,100000);
+
+ Thread.Sleep(1000);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ for(int i = 0;i<tArray.Length;i++)
+ tArray[i] = new Timer(new TimerCallback(TFunc),0,1000,100000);
+
+ Thread.Sleep(1000);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ for(int i = 0;i<tArray.Length;i++)
+ tArray[i] = new Timer(new TimerCallback(TFunc),0,1000,100000);
+
+ Thread.Sleep(1000);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ for(int i = 0;i<tArray.Length;i++)
+ tArray[i] = new Timer(new TimerCallback(TFunc),0,1000,100000);
+
+ Thread.Sleep(1000);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ for(int i = 0;i<tArray.Length;i++)
+ tArray[i] = new Timer(new TimerCallback(TFunc),0,1000,100000);
+
+ Thread.Sleep(1000);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+
+ return rValue;
+ }
+
+ public static void TFunc(Object o)
+ {
+ Thread.Sleep(1);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/13662/13662-b.csproj b/tests/src/baseservices/threading/regressions/13662/13662-b.csproj
new file mode 100644
index 0000000000..9b8820f579
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/13662/13662-b.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="13662-b.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/13662/13662-simple.csproj b/tests/src/baseservices/threading/regressions/13662/13662-simple.csproj
new file mode 100644
index 0000000000..94e44db77c
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/13662/13662-simple.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="simple.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/13662/simple.cs b/tests/src/baseservices/threading/regressions/13662/simple.cs
new file mode 100644
index 0000000000..230c63951f
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/13662/simple.cs
@@ -0,0 +1,33 @@
+// 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.Threading;
+
+
+public class Test {
+
+ public static int Main(){
+
+ int rValue = 100;
+ Timer[] tArray = new Timer[100];
+ int val = 0;
+ while(val < 10){
+ Interlocked.Increment(ref val);
+ Console.WriteLine("Loop {0}",val);
+ for(int i = 0;i<tArray.Length;i++)
+ tArray[i] = new Timer(new TimerCallback(TFunc),0,1000,1000000);
+
+ Thread.Sleep(1000);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ }
+ return rValue;
+ }
+
+ public static void TFunc(Object o)
+ {
+ Thread.Sleep(1);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/17360/AVHelper.csproj b/tests/src/baseservices/threading/regressions/17360/AVHelper.csproj
new file mode 100644
index 0000000000..8f639a42e2
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/17360/AVHelper.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="avhelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/17360/avhelper.cs b/tests/src/baseservices/threading/regressions/17360/avhelper.cs
new file mode 100644
index 0000000000..6632139736
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/17360/avhelper.cs
@@ -0,0 +1,40 @@
+// 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.Runtime.InteropServices;
+using System.Reflection;
+using System.Threading;
+
+namespace AVHelper
+{
+ public interface ICreateAV
+ {
+ void SpinThread();
+ int ThreadName();
+ }
+
+ public class CreateAV : ICreateAV
+ {
+ public String myAV;
+
+ public CreateAV(){}
+
+ public void SpinThread()
+ {
+ myAV = "Created a new String -- Let's get an AV";
+ Console.WriteLine("Running SpinThread");
+ }
+
+ public int ThreadName()
+ {
+ Console.WriteLine(myAV);
+ return 100;
+ }
+
+ ~CreateAV()
+ {
+ Thread.Sleep(Timeout.Infinite);
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/regressions/269336/objmonhelper.cs b/tests/src/baseservices/threading/regressions/269336/objmonhelper.cs
new file mode 100644
index 0000000000..60185dc496
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/269336/objmonhelper.cs
@@ -0,0 +1,37 @@
+// 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.Threading;
+
+class ObjMonHelper {
+ const string FailMsg = @"Monitor.Enter appears to have mistaken a hash code in an object header for
+a valid lock owned by the current thread.";
+
+ public static int Main() {
+ var ok = true;
+ var arr = new object[1024*1024];
+
+ // Call GetHashCode to populate the object header with its hash
+ for (var i = 0; i < arr.Length; i++) {
+ arr[i] = new object();
+ arr[i].GetHashCode();
+ }
+
+ // Attempt to lock and unlock each object. If the bug is present, the object will appear
+ // to be locked by the current thread and Monitor.Enter will incorrectly take a fast path.
+ // Monitor.Exit will then correctly take the slow path, find that the object is not locked,
+ // and throw.
+ try {
+ for (var i = 0; i < arr.Length; i++)
+ lock (arr[i])
+ GC.KeepAlive(arr[i]);
+ } catch (SynchronizationLockException) {
+ ok = false;
+ }
+
+ Console.WriteLine(ok ? "Test passed" : FailMsg);
+ return ok ? 100 : -1;
+ }
+}
diff --git a/tests/src/baseservices/threading/regressions/269336/objmonhelper.csproj b/tests/src/baseservices/threading/regressions/269336/objmonhelper.csproj
new file mode 100644
index 0000000000..ae7e32f7f8
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/269336/objmonhelper.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="ObjMonHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/30032/30032.cs b/tests/src/baseservices/threading/regressions/30032/30032.cs
new file mode 100644
index 0000000000..caf979e6b8
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/30032/30032.cs
@@ -0,0 +1,40 @@
+// 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.Threading;
+
+
+public class Test {
+
+ public static int Main(){
+
+ int rValue = 100;
+ Timer[] tArray = new Timer[100];
+ int val = 0;
+ while(val < 10){
+ try{
+ Interlocked.Increment(ref val);
+ Console.WriteLine("Loop {0}",val);
+ for(int i = 0;i<tArray.Length;i++)
+ tArray[i] = new Timer(new TimerCallback(TFunc),0,1000,100000000);
+
+ Thread.Sleep(1000);
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ }
+ catch(Exception e){
+ Console.WriteLine(e.ToString());
+ rValue = -1;
+ }
+ }
+ Console.WriteLine("Test {0}",100 == rValue ? "Passed":"Failed");
+ return rValue;
+ }
+
+ public static void TFunc(Object o)
+ {
+ Thread.Sleep(1);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/30032/30032.csproj b/tests/src/baseservices/threading/regressions/30032/30032.csproj
new file mode 100644
index 0000000000..2c5aed90c0
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/30032/30032.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="30032.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/576463/576463.cs b/tests/src/baseservices/threading/regressions/576463/576463.cs
new file mode 100644
index 0000000000..d39acadad8
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/576463/576463.cs
@@ -0,0 +1,172 @@
+// 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.Threading;
+
+class Test
+{
+ bool _aRun = false;
+ public void A()
+ {
+ _aRun = true;
+ Console.WriteLine("A");
+ }
+
+ bool _bRun = false;
+ public void B()
+ {
+ _bRun = true;
+ Console.WriteLine("B");
+ }
+
+ volatile bool _cRun = false;
+ public void C()
+ {
+ _cRun = true;
+ Console.WriteLine("C");
+ if (s_takeLock)
+ {
+ Console.WriteLine("C: Entering -- Monitor on _objLock");
+
+ Monitor.Enter(_objLock);
+
+ Console.WriteLine("C: Entered -- Monitor on _objLock");
+
+ Console.WriteLine("C: Exiting -- Monitor on _objLock");
+ Monitor.Exit(_objLock);
+ Console.WriteLine("C: Exited -- Monitor on _objLock");
+ }
+ }
+
+ bool _dRun = false;
+ public void D()
+ {
+ _dRun = true;
+ Console.WriteLine("D");
+ }
+
+ public bool Pass()
+ {
+ bool testPassed = true;
+ if (_aRun == false)
+ {
+ Console.WriteLine("Delegate A did not run");
+ testPassed = false;
+ }
+
+ if (_bRun == false)
+ {
+ Console.WriteLine("Delegate B did not run");
+ testPassed = false;
+ }
+
+ if (_cRun == false)
+ {
+ Console.WriteLine("Delegate C did not run");
+ testPassed = false;
+ }
+
+ if (_dRun == false)
+ {
+ Console.WriteLine("Delegate D did not run");
+ testPassed = false;
+ }
+
+ return testPassed;
+ }
+
+ public void Send()
+ {
+ if (_cb != null)
+ _cb();
+ }
+
+ volatile object _objLock = new object();
+
+ delegate void GenericCallback();
+ event GenericCallback _cb;
+
+ public static void ReadArgs(string[] args)
+ {
+ for (int i = 0; i < args.Length; i++)
+ {
+ switch (args[i])
+ {
+ case "/contention":
+ s_contention = true;
+ goto case "/lock";
+ case "/lock":
+ s_takeLock = true;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ static bool s_takeLock = false;
+ static bool s_contention = false;
+
+ public static int Main(string[] args)
+ {
+ ReadArgs(args);
+
+ Test t = new Test();
+
+ // subscribe methods to the event
+ t._cb += t.A;
+ t._cb += t.B;
+ // C will take a Monitor on t._objLock, if we are holding it when
+ // C tries to take the lock it should spin, and in the failure case
+ // D will not get called.
+ t._cb += t.C;
+ t._cb += t.D;
+
+ if (s_contention)
+ {
+ Console.WriteLine("Main: Entering -- Monitor on _objLock");
+ Monitor.Enter(t._objLock);
+ Console.WriteLine("Main: Entered -- Monitor on _objLock");
+ }
+
+ // Start a new thread with t.Send() as the ThreadStart delegate
+ Thread newThread = new Thread(new ThreadStart(t.Send));
+ newThread.Start();
+
+ if (s_contention)
+ {
+ while (!t._cRun)
+ {
+ Thread.Sleep(100);
+ }
+
+ // We know C has started running, wait a little bit to let
+ // it get into the Monitor.Enter code. This has a possible race.
+ Thread.Sleep(5000);
+
+ // Once we're here we know that C has started running and
+ // is presumably in the Monitor.Enter code, now we release
+ // the lock to let C have it
+ Console.WriteLine("Main: Exiting -- Monitor on _objLock");
+ Monitor.Exit(t._objLock);
+ Console.WriteLine("Main: Exited -- Monitor on _objLock");
+ }
+
+ // Wait for the eventing on the other thread to finish
+ newThread.Join();
+
+ // Check whether or not all callbacks were called
+ if (t.Pass())
+ {
+ Console.WriteLine("Test passed!");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test failed!");
+ Console.WriteLine("If some delegegates did not run, this failure is most likely due to the loopcount register not being properly tracked during assembly for monitor.");
+ return 50;
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/576463/576463.csproj b/tests/src/baseservices/threading/regressions/576463/576463.csproj
new file mode 100644
index 0000000000..7c8c8c834c
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/576463/576463.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="576463.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/6906/6906.csproj b/tests/src/baseservices/threading/regressions/6906/6906.csproj
new file mode 100644
index 0000000000..3cace5d67e
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/6906/6906.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="repro.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/6906/repro.cs b/tests/src/baseservices/threading/regressions/6906/repro.cs
new file mode 100644
index 0000000000..cb6e3ca347
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/6906/repro.cs
@@ -0,0 +1,41 @@
+// 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.Threading;
+
+
+public class Beta
+{
+ public static int Main(string[] args)
+ {
+ int rValue = 100;
+ Console.WriteLine("Setup an Infinite Wait with negative value other than -1");
+ Console.WriteLine("This can't be done on WaitAny and WaitAll");
+ WaitHandle Waiter;
+ Waiter = (WaitHandle) new AutoResetEvent(false);
+
+ try{
+ Waiter.WaitOne(-2);
+ Console.WriteLine("ERROR -- Enabled a wait with -2");
+ rValue = 10;
+ }catch(ArgumentOutOfRangeException){}
+
+ try{
+ Waiter.WaitOne(Int32.MinValue);
+ Console.WriteLine("ERROR -- Enabled a wait with {0}",Int32.MinValue);
+
+ rValue = 20;
+ }catch(ArgumentOutOfRangeException){}
+
+ try{
+ Waiter.WaitOne(-1000000);
+ Console.WriteLine("ERROR -- Enabled a wait with -1000000");
+ rValue = 20;
+ }catch(ArgumentOutOfRangeException){}
+
+ Console.WriteLine("Test {0}",rValue == 100 ? "Passed":"Failed");
+ return rValue;
+
+ }
+}
diff --git a/tests/src/baseservices/threading/regressions/beta1/347011.cs b/tests/src/baseservices/threading/regressions/beta1/347011.cs
new file mode 100644
index 0000000000..fa0377b6aa
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/beta1/347011.cs
@@ -0,0 +1,35 @@
+// 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.Threading;
+
+public class TimerTest
+{
+ public static void Target(Object foo){}
+
+ public static int Main()
+ {
+ int retVal = 0;
+ Timer timer = new Timer(new TimerCallback(Target),new Object(), 1000,1000);
+ timer.Dispose();
+ try
+ {
+ timer.Change(5000,5000);
+ retVal = -5;
+ }
+ catch(ObjectDisposedException)
+ {
+ Console.WriteLine("Caught Expected exception");
+ retVal = 100;
+ }
+ catch(Exception ex)
+ {
+ Console.WriteLine("Unexpected exception: " + ex.ToString());
+ retVal = -1;
+ }
+ Console.WriteLine(100 == retVal ? "Test Passed":"Test Failed");
+ return retVal;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/beta1/347011.csproj b/tests/src/baseservices/threading/regressions/beta1/347011.csproj
new file mode 100644
index 0000000000..1b9d480da2
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/beta1/347011.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>240</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="347011.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/beta2/437017.cs b/tests/src/baseservices/threading/regressions/beta2/437017.cs
new file mode 100644
index 0000000000..284a5ae8df
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/beta2/437017.cs
@@ -0,0 +1,125 @@
+// 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.Threading;
+
+class Test
+{
+ static bool _fTestFailed = false;
+ static bool _fTestDone = false;
+ static ManualResetEvent _mre;
+ static AutoResetEvent _are = new AutoResetEvent(false);
+
+ public static int Main(string[] args)
+ {
+ Thread th = new Thread(new ThreadStart(Thread2));
+ th.Start();
+ Thread th2 = new Thread(new ThreadStart(Thread3));
+ th2.Start();
+ System.Diagnostics.Stopwatch myTimer = new System.Diagnostics.Stopwatch();
+ myTimer.Start();
+
+ int i = 0;
+ while (!_fTestFailed && myTimer.Elapsed.Minutes < 5 && i < 25000)
+ {
+ i++;
+ ManualResetEvent mre = new ManualResetEvent(false);
+ _mre = new ManualResetEvent(false);
+ RegisteredWaitHandle rwh = ThreadPool.RegisterWaitForSingleObject(mre, new WaitOrTimerCallback(callback), null, -1, false);
+ _are.Set();
+
+ bool bUnregisterSucceeded = false; //Used to improve speed of the test when Unregister has failed
+ try
+ {
+ rwh.Unregister(_mre);
+ bUnregisterSucceeded = true;
+ }
+ catch (ObjectDisposedException)
+ {
+ }
+
+ if (bUnregisterSucceeded)
+ {
+ try
+ {
+ if (_mre.WaitOne(0))
+ {
+ Console.Write("@");
+ }
+ }
+ catch (ObjectDisposedException)
+ {
+ }
+ }
+
+ if (i % 100 == 0) Console.WriteLine(i);
+ }
+ _fTestDone = true;
+ _are.Set();
+ th.Join();
+ th2.Join();
+
+ if (!_fTestFailed)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+
+ Console.WriteLine("Test Failed");
+ return 101;
+
+ }
+
+ static void callback(object state, bool fTimedOut)
+ {
+ Console.Write("!");
+ _fTestFailed = true;
+ }
+
+ public static void Thread3()
+ {
+ while (true & !_fTestDone)
+ {
+ _are.WaitOne();
+ _mre.Dispose();
+ }
+ }
+
+ public static void Thread2()
+ {
+ while (true & !_fTestDone)
+ {
+ Console.Write("#");
+ AutoResetEvent are;
+ using (are = new AutoResetEvent(false))
+ {
+ if (are.WaitOne(0))
+ {
+ Console.WriteLine("ARE Signaled!");
+ _fTestFailed = true;
+ }
+ }
+
+ using (are = new AutoResetEvent(false))
+ {
+ if (are.WaitOne(0))
+ {
+ Console.WriteLine("ARE Signaled!");
+ _fTestFailed = true;
+ }
+ }
+
+ using(are = new AutoResetEvent(false))
+ {
+ if (are.WaitOne(0))
+ {
+ Console.WriteLine("ARE Signaled!");
+ _fTestFailed = true;
+ }
+ }
+ }
+ }
+}
+
diff --git a/tests/src/baseservices/threading/regressions/beta2/437017.csproj b/tests/src/baseservices/threading/regressions/beta2/437017.csproj
new file mode 100644
index 0000000000..cdb2952666
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/beta2/437017.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="437017.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/beta2/437044.cs b/tests/src/baseservices/threading/regressions/beta2/437044.cs
new file mode 100644
index 0000000000..9da799fc90
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/beta2/437044.cs
@@ -0,0 +1,119 @@
+// 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.Threading;
+
+class Test
+{
+ static bool _fTestFailed = false;
+ static bool _fTestDone = false;
+ static ManualResetEvent _mre;
+ static AutoResetEvent _are = new AutoResetEvent(false);
+
+ public static int Main(string[] args)
+ {
+ Thread th = new Thread(new ThreadStart(Thread2));
+ th.Start();
+ Thread th2 = new Thread(new ThreadStart(Thread3));
+ th2.Start();
+
+ for (int i = 0; i < 20000 && !_fTestFailed; i++)
+ {
+ _mre = new ManualResetEvent(false);
+ Timer t = new Timer(new TimerCallback(callback), null, 1000000, Timeout.Infinite);
+ _are.Set();
+
+ bool bDisposeSucceeded = false; //Used to improve speed of the test when Dispose has failed
+ try
+ {
+ t.Dispose();
+ bDisposeSucceeded = true;
+ }
+ catch (ObjectDisposedException)
+ {
+ }
+
+ if (bDisposeSucceeded)
+ {
+ try
+ {
+ if (_mre.WaitOne(0))
+ {
+ Console.Write("@");
+ }
+ }
+ catch (ObjectDisposedException)
+ {
+ }
+ }
+ }
+ _fTestDone = true;
+ _are.Set();
+ th.Join();
+ th2.Join();
+
+ if (!_fTestFailed)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+
+ Console.WriteLine("Test Failed");
+ return 101;
+
+ }
+
+ static void callback(object state)
+ {
+ Console.Write("!");
+ _fTestFailed = true;
+ }
+
+ public static void Thread3()
+ {
+ while (true & !_fTestDone)
+ {
+ _are.WaitOne();
+ _mre.Dispose();
+ }
+ }
+
+ public static void Thread2()
+ {
+ while (true & !_fTestDone)
+ {
+ Console.Write("#");
+ AutoResetEvent are;
+
+ using(are = new AutoResetEvent(false))
+ {
+ if (are.WaitOne(0))
+ {
+ Console.WriteLine("ARE Signaled!");
+ _fTestFailed = true;
+ }
+ }
+
+ using(are = new AutoResetEvent(false))
+ {
+ if (are.WaitOne(0))
+ {
+ Console.WriteLine("ARE Signaled!");
+ _fTestFailed = true;
+ }
+ }
+
+ using(are = new AutoResetEvent(false))
+ {
+ if (are.WaitOne(0))
+ {
+ Console.WriteLine("ARE Signaled!");
+ _fTestFailed = true;
+ }
+ }
+ }
+ }
+}
+
diff --git a/tests/src/baseservices/threading/regressions/beta2/437044.csproj b/tests/src/baseservices/threading/regressions/beta2/437044.csproj
new file mode 100644
index 0000000000..794e32fcf1
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/beta2/437044.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="437044.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/devdiv489437/test489437.cs b/tests/src/baseservices/threading/regressions/devdiv489437/test489437.cs
new file mode 100644
index 0000000000..8b3754f704
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/devdiv489437/test489437.cs
@@ -0,0 +1,52 @@
+// 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.Threading;
+using System.Threading.Tasks;
+
+/*
+ * Issue description:
+ If a SemaphoreSlim.WaitAsync call is cancelled just after Release has
+ caused it to start to complete, we end up decrementing the semaphore's
+ count *and* cancelling the task. The caller does not know the count has
+ been decremented, because the call appears to fail. This leads to
+ deadlock later, because the caller has no reason to believe it should
+ release the erroneously-acquired count.
+
+Change description:
+ If the operation has already begun completing successfully, do not
+ cancel the associated Task.
+*/
+
+class Test
+{
+ static int Main(string[] args)
+ {
+ SemaphoreSlim s = new SemaphoreSlim(initialCount: 1);
+
+ var cts = new CancellationTokenSource();
+ s.Wait();
+ var t = s.WaitAsync(cts.Token);
+ s.Release();
+ cts.Cancel();
+
+
+ if (t.Status != TaskStatus.Canceled && s.CurrentCount == 0)
+ {
+ Console.WriteLine("PASS");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("FAIL");
+ Console.WriteLine("Expected task status to not be Canceled and s.CurrentCount == 0");
+ Console.WriteLine("Actual: Task: " + t.Status + "; CurrentCount: " + s.CurrentCount);
+ return 101;
+ }
+
+
+ }
+}
+
diff --git a/tests/src/baseservices/threading/regressions/devdiv489437/test489437.csproj b/tests/src/baseservices/threading/regressions/devdiv489437/test489437.csproj
new file mode 100644
index 0000000000..4406829a69
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/devdiv489437/test489437.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="test489437.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/threadex.cs b/tests/src/baseservices/threading/regressions/threadex.cs
new file mode 100644
index 0000000000..f57a094be7
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/threadex.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Threading;
+using System.Reflection;
+
+public class ThreadEx
+{
+ public static void Abort(Thread thread)
+ {
+ MethodInfo abort = null;
+ foreach(MethodInfo m in thread.GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Instance))
+ {
+ if (m.Name.Equals("AbortInternal") && m.GetParameters().Length == 0) abort = m;
+ }
+ if (abort == null)
+ {
+ throw new Exception("Failed to get Thread.Abort method");
+ }
+ abort.Invoke(thread, new object[0]);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/whidbey_m3/200176.cs b/tests/src/baseservices/threading/regressions/whidbey_m3/200176.cs
new file mode 100644
index 0000000000..6a053a1301
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/whidbey_m3/200176.cs
@@ -0,0 +1,33 @@
+// 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.Threading;
+
+public class Stop {
+
+ public static int Main(String[] args) {
+
+ Stop tm = new Stop();
+ try
+ {
+
+ ThreadPool.QueueUserWorkItem(new WaitCallback(tm.RunTest));
+ Thread.Sleep(3000);
+ }
+ catch
+ {
+ return -1;
+ }
+ return 100;
+ }
+ public void RunTest(object foo)
+ {
+ try{
+ throw new Exception();
+ }
+ catch
+ {}
+ }
+}
diff --git a/tests/src/baseservices/threading/regressions/whidbey_m3/200176.csproj b/tests/src/baseservices/threading/regressions/whidbey_m3/200176.csproj
new file mode 100644
index 0000000000..bef3dcaa2e
--- /dev/null
+++ b/tests/src/baseservices/threading/regressions/whidbey_m3/200176.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="200176.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector1.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector1.cs
new file mode 100644
index 0000000000..cd13936ada
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector1.cs
@@ -0,0 +1,69 @@
+// 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.Threading;
+
+class CtorTest
+{
+ public static int Main(string[] args)
+ {
+ // Check args
+ if (args.Length != 2)
+ {
+ Console.WriteLine("USAGE: SemaphoreCtor1 /iCount:<int> /mCount:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iCount = -1, mCount = -1;
+
+ for (int i = 0; i < args.Length; i++)
+ {
+ if (args[i].ToLower().StartsWith("/icount:"))
+ {
+ iCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/mcount:"))
+ {
+ mCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+ }
+ CtorTest ct = new CtorTest();
+ return ct.Run(iCount, mCount);
+ }
+
+ private int Run(int iCount, int mCount)
+ {
+ // Testing basic scenario
+ int iRet = -1;
+ Semaphore sem = null;
+ try
+ {
+ using (sem = new Semaphore(iCount, mCount))
+ {
+ int iPrev = 0, count = iCount;
+ // Do a wait one if we can
+ if (iCount > 0)
+ {
+ sem.WaitOne();
+ count--;
+ }
+ iPrev = sem.Release();
+
+ if (iPrev == count)
+ iRet = 100;
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("FAIL: CtorTest1(" + iCount + "," + mCount + ") - Unexpected exception thrown: " + ex.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector1.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector1.csproj
new file mode 100644
index 0000000000..990183bbde
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector1.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/iCount:2147483647 /mCount:2147483647</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreCtor1.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector2.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector2.cs
new file mode 100644
index 0000000000..060c9f8de5
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector2.cs
@@ -0,0 +1,99 @@
+// 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.Threading;
+
+class CtorTest
+{
+ public static int Main(string[] args)
+ {
+ // Check args
+ if (args.Length < 2)
+ {
+ Console.WriteLine("USAGE: SemaphoreCtor2 /iCount:<int> /mCount:<int> " +
+ "[/semName:<string>] [/iRandom:<int>]");
+ return -1;
+ }
+
+ // Get the args
+ int iCount = -1, mCount = -1, iRandom = -1;
+ string semName = "DefaultString";
+
+ for (int i = 0; i < args.Length; i++)
+ {
+ if (args[i].ToLower().StartsWith("/icount:"))
+ {
+ iCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/mcount:"))
+ {
+ mCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/irandom:"))
+ {
+ iRandom = Convert.ToInt32(args[i].Substring(9));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/semname:"))
+ {
+ semName = args[i].Substring(9);
+ if (semName.ToLower() == "null")
+ semName = null;
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/unisemname:"))
+ {
+ semName = string.Empty;
+ // Convert to unicode
+ string[] s = args[i].Substring(12).Split(';');
+ foreach (string str in s)
+ semName += Convert.ToChar(Convert.ToInt32(str));
+ continue;
+ }
+ }
+ CtorTest ct = new CtorTest();
+ return ct.Run(iCount, mCount, semName, iRandom);
+ }
+
+ private int Run(int iCount, int mCount, string semName, int iRandom)
+ {
+ // Testing basic string scenario
+ int iRet = -1, count = iCount;
+ Semaphore sem1 = null, sem2 = null;
+ if (iRandom > 0)
+ semName = Common.GenerateUnicodeString(iRandom);
+ try
+ {
+ using (sem1 = new Semaphore(iCount, mCount, semName))
+ {
+ using (sem2 = (semName != null && semName != string.Empty) ? Semaphore.OpenExisting(semName) : sem1)
+ {
+ if (iCount > 0)
+ {
+ sem2.WaitOne();
+ count--;
+ }
+
+ int iPrev = sem2.Release();
+
+ if (iPrev == count)
+ iRet = 100;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + ex.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector2.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector2.csproj
new file mode 100644
index 0000000000..0bef00763c
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/iCount:0 /mCount:1 /semName:MySemaphoreName</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreCtor2.cs" />
+ <Compile Include="..\SemaphoreCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector3.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector3.cs
new file mode 100644
index 0000000000..52144bc138
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector3.cs
@@ -0,0 +1,128 @@
+// 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.Threading;
+
+class CtorTest
+{
+ public static int Main(string[] args)
+ {
+ // Check args
+ if (args.Length < 2)
+ {
+ Console.WriteLine("USAGE: SemaphoreCtor3 /iCount:<int> /mCount:<int> " +
+ "[/semName:<string>] [/iRandom:<int>]");
+ return -1;
+ }
+
+ // Get the args
+ int iCount = -1, mCount = -1, iRandom = -1;
+ string semName = "DefaultString";
+
+ for (int i = 0; i < args.Length; i++)
+ {
+ if (args[i].ToLower().StartsWith("/icount:"))
+ {
+ iCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/mcount:"))
+ {
+ mCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/irandom:"))
+ {
+ iRandom = Convert.ToInt32(args[i].Substring(9));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/semname:"))
+ {
+ semName = args[i].Substring(9);
+ if (semName.ToLower() == "null")
+ semName = null;
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/unisemname:"))
+ {
+ semName = string.Empty;
+ // Convert to unicode
+ string[] s = args[i].Substring(12).Split(';');
+ foreach (string str in s)
+ semName += Convert.ToChar(Convert.ToInt32(str));
+ continue;
+ }
+ }
+ CtorTest ct = new CtorTest();
+ return ct.Run(iCount, mCount, semName, iRandom);
+ }
+
+ private int Run(int iCount, int mCount, string semName, int iRandom)
+ {
+ // Testing overlap of long strings
+ int iRet = -1;
+ Semaphore sem1 = null, sem2 = null, sem3 = null,
+ sem4 = null, sem6 = null;
+ if (iRandom > 0)
+ {
+ //TestFramework.GlobalData intl = new TestFramework.GlobalData();
+ //semName = intl.GetString(iRandom, iRandom).Replace(@"\", "");
+ Console.WriteLine("WARNING: No random name generation is ocurring");
+ }
+ string semNewName = semName.Remove(semName.Length - 2, 1);
+ try
+ {
+ // Create slightly different names
+ using (sem1 = new Semaphore(iCount, mCount, semName))
+ {
+ sem2 = new Semaphore(iCount, mCount, semNewName);
+ // Make sure we can open it
+ using(sem3 = Semaphore.OpenExisting(semName))
+ {
+ sem4 = Semaphore.OpenExisting(semNewName);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + ex.ToString());
+ Console.WriteLine("Test Failed");
+ return iRet;
+ }
+
+ // Make sure you can't open it
+ try
+ {
+ Semaphore sem5 = Semaphore.OpenExisting(semName);
+ }
+ catch (WaitHandleCannotBeOpenedException)
+ {
+ // This is expected
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + e.ToString());
+ Console.WriteLine("Test Failed");
+ return iRet;
+ }
+
+ // Make sure you can still open the other one
+ sem6 = Semaphore.OpenExisting(semNewName);
+ // Do a wait and release
+ sem6.WaitOne();
+ sem6.Release();
+ iRet = 100;
+
+ //Add a subsequent use of sem2 to avoid system event be GCed.
+ GC.KeepAlive(sem2);
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector3.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector3.csproj
new file mode 100644
index 0000000000..c2552e8be2
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector3.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/iCount:10 /mCount:10 /semname:abcdefghijklmnopqrstuvwxyz</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreCtor3.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector4.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector4.cs
new file mode 100644
index 0000000000..fff49e49ef
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector4.cs
@@ -0,0 +1,97 @@
+// 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.Threading;
+
+class CtorTest
+{
+ public static int Main(string[] args)
+ {
+ // Check args
+ if (args.Length < 2)
+ {
+ Console.WriteLine("USAGE: SemaphoreCtor4 /iCount:<int> /mCount:<int> " +
+ "[/semName:<string>] [/iRandom:<int>]");
+ return -1;
+ }
+
+ // Get the args
+ int iCount = -1, mCount = -1, iRandom = -1;
+ string semName = "DefaultString";
+
+ for (int i = 0; i < args.Length; i++)
+ {
+ if (args[i].ToLower().StartsWith("/icount:"))
+ {
+ iCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/mcount:"))
+ {
+ mCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/irandom:"))
+ {
+ iRandom = Convert.ToInt32(args[i].Substring(9));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/semname:"))
+ {
+ semName = args[i].Substring(9);
+ if (semName.ToLower() == "null")
+ semName = null;
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/unisemname:"))
+ {
+ semName = string.Empty;
+ // Convert to unicode
+ string[] s = args[i].Substring(12).Split(';');
+ foreach (string str in s)
+ semName += Convert.ToChar(Convert.ToInt32(str));
+ continue;
+ }
+ }
+ CtorTest ct = new CtorTest();
+ return ct.Run(iCount, mCount, semName, iRandom);
+ }
+
+ private int Run(int iCount, int mCount, string semName, int iRandom)
+ {
+ // Testing createdNew
+ bool createdNew;
+ int iRet = -1, count = iCount;
+ Semaphore sem = null;
+ if (iRandom > 0)
+ semName = Common.GenerateUnicodeString(iRandom);
+ try
+ {
+ using(sem = new Semaphore(iCount, mCount, semName, out createdNew))
+ {
+ if (iCount > 0)
+ {
+ sem.WaitOne();
+ count--;
+ }
+
+ int iPrev = sem.Release();
+ if (iPrev == count && createdNew)
+ iRet = 100;
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + ex.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector4.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector4.csproj
new file mode 100644
index 0000000000..9092d3c5fb
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector4.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/iCount:3 /mCount:5 /iRandom:260</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreCtor4.cs" />
+ <Compile Include="..\SemaphoreCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector5.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector5.cs
new file mode 100644
index 0000000000..27bfb5c5b7
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector5.cs
@@ -0,0 +1,108 @@
+// 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.Threading;
+
+class CtorTest
+{
+ public static int Main(string[] args)
+ {
+ // Check args
+ if (args.Length < 2)
+ {
+ Console.WriteLine("USAGE: SemaphoreCtor4 /iCount:<int> /mCount:<int> " +
+ "[/semName:<string>] [/iRandom:<int>]");
+ return -1;
+ }
+
+ // Get the args
+ int iCount = -1, mCount = -1, iRandom = -1;
+ string semName = "DefaultString";
+
+ for (int i = 0; i < args.Length; i++)
+ {
+ if (args[i].ToLower().StartsWith("/icount:"))
+ {
+ iCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/mcount:"))
+ {
+ mCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/irandom:"))
+ {
+ iRandom = Convert.ToInt32(args[i].Substring(9));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/semname:"))
+ {
+ semName = args[i].Substring(9);
+ if (semName.ToLower() == "null")
+ semName = null;
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/unisemname:"))
+ {
+ semName = string.Empty;
+ // Convert to unicode
+ string[] s = args[i].Substring(12).Split(';');
+ foreach (string str in s)
+ semName += Convert.ToChar(Convert.ToInt32(str));
+ continue;
+ }
+ }
+ CtorTest ct = new CtorTest();
+ return ct.Run(iCount, mCount, semName, iRandom);
+ }
+
+ private int Run(int iCount, int mCount, string semName, int iRandom)
+ {
+ // Testing createdNew
+ bool createdNew, createdNew2;
+ bool bResult = true;
+ int iRet = -1, count = iCount;
+ Semaphore sem1 = null, sem2 = null;
+ if (iRandom > 0)
+ semName = Common.GenerateUnicodeString(iRandom);
+ try
+ {
+ // Open one, createdNew = true
+ using (sem1 = new Semaphore(iCount, mCount, semName, out createdNew))
+ {
+ if (!createdNew)
+ bResult = false;
+ // Open another, createdNew = false
+ using (sem2 = new Semaphore(iCount, mCount, semName, out createdNew2))
+ {
+ if (createdNew2)
+ bResult = false;
+
+ if (iCount > 0)
+ {
+ sem2.WaitOne();
+ count--;
+ }
+
+ int iPrev = sem2.Release();
+ if (bResult && iPrev == count)
+ iRet = 100;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + ex.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector5.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector5.csproj
new file mode 100644
index 0000000000..14346afcb0
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorector5.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/iCount:2147483647 /mCount:2147483647 /iRandom:220</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreCtor5.cs" />
+ <Compile Include="..\SemaphoreCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg1.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg1.cs
new file mode 100644
index 0000000000..f9386e1813
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg1.cs
@@ -0,0 +1,65 @@
+// 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.Threading;
+
+class CtorTest
+{
+ public static int Main(string[] args)
+ {
+ // Check args
+ if (args.Length != 2)
+ {
+ Console.WriteLine("USAGE: SemaphoreCtorNeg1 /iCount:<int> /mCount:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iCount = -1, mCount = -1;
+
+ for (int i = 0; i < args.Length; i++)
+ {
+ if (args[i].ToLower().StartsWith("/icount:"))
+ {
+ iCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/mcount:"))
+ {
+ mCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+ }
+ CtorTest ct = new CtorTest();
+ return ct.Run(iCount, mCount);
+ }
+
+ private int Run(int initCount, int maxCount)
+ {
+ int iRet = -1;
+ Semaphore sem = null;
+ try
+ {
+ using (sem = new Semaphore(initCount, maxCount))
+ {
+ Console.WriteLine("Semaphore was created!");
+ }
+ }
+ catch(ArgumentException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ // other exceptions are not valid
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg1.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg1.csproj
new file mode 100644
index 0000000000..11e7a4a678
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg1.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/iCount:-2147483647 /mCount:2147483647</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreCtorNeg1.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg2.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg2.cs
new file mode 100644
index 0000000000..f99c8769b6
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg2.cs
@@ -0,0 +1,93 @@
+// 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.Threading;
+
+class CtorTest
+{
+ public static int Main(string[] args)
+ {
+ // Check args
+ if (args.Length < 3)
+ {
+ Console.WriteLine("USAGE: SemaphoreCtorNeg2 /iCount:<int> /mCount:<int> " +
+ "/semName:<string> [/iRandom:<int>]");
+ return -1;
+ }
+
+ // Get the args
+ int iCount = -1, mCount = -1, iRandom = -1;
+ string semName = "DefaultString";
+
+ for (int i = 0; i < args.Length; i++)
+ {
+ if (args[i].ToLower().StartsWith("/icount:"))
+ {
+ iCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/mcount:"))
+ {
+ mCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/irandom:"))
+ {
+ iRandom = Convert.ToInt32(args[i].Substring(9));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/semname:"))
+ {
+ semName = args[i].Substring(9);
+ if (semName.ToLower() == "null")
+ semName = null;
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/unisemname:"))
+ {
+ semName = string.Empty;
+ // Convert to unicode
+ string[] s = args[i].Substring(12).Split(';');
+ foreach (string str in s)
+ semName += Convert.ToChar(Convert.ToInt32(str));
+ continue;
+ }
+ }
+ CtorTest ct = new CtorTest();
+ return ct.Run(iCount, mCount, semName, iRandom);
+ }
+
+ private int Run(int initalValue, int maxValue, string semName, int iRandom)
+ {
+ int iRet = -1;
+ Semaphore sem = null;
+ if (iRandom > 0)
+ semName = Common.GenerateUnicodeString(iRandom);
+ try
+ {
+ using (sem = new Semaphore(initalValue, maxValue, semName))
+ {
+ Console.WriteLine("Semaphore was created!");
+ }
+ }
+ catch(ArgumentException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg2.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg2.csproj
new file mode 100644
index 0000000000..cfac4acfbb
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg2.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/iCount:-1 /mCount:3 /semName:" "</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreCtorNeg2.cs" />
+ <Compile Include="..\SemaphoreCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg3.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg3.cs
new file mode 100644
index 0000000000..724853c552
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg3.cs
@@ -0,0 +1,103 @@
+// 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.Threading;
+
+class CtorTest
+{
+ public static int Main(string[] args)
+ {
+ // Check args
+ if (args.Length < 3)
+ {
+ Console.WriteLine("USAGE: SemaphoreCtorNeg3 /iCount:<int> /mCount:<int> " +
+ "[/semName:<string>] [/iRandom:<int>]");
+ return -1;
+ }
+
+ // Get the args
+ int iCount = -1, mCount = -1, iRandom = -1;
+ string semName = "DefaultString";
+
+ for (int i = 0; i < args.Length; i++)
+ {
+ if (args[i].ToLower().StartsWith("/icount:"))
+ {
+ iCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/mcount:"))
+ {
+ mCount = Convert.ToInt32(args[i].Substring(8));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/irandom:"))
+ {
+ iRandom = Convert.ToInt32(args[i].Substring(9));
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/semname:"))
+ {
+ semName = args[i].Substring(9);
+ if (semName.ToLower() == "null")
+ semName = null;
+ continue;
+ }
+
+ if (args[i].ToLower().StartsWith("/unisemname:"))
+ {
+ semName = string.Empty;
+ // Convert to unicode
+ string[] s = args[i].Substring(12).Split(';');
+ foreach (string str in s)
+ semName += Convert.ToChar(Convert.ToInt32(str));
+ continue;
+ }
+ }
+ CtorTest ct = new CtorTest();
+ return ct.Run(iCount, mCount, semName, iRandom);
+ }
+
+ private int Run(int initalValue, int maxValue, string semName,
+ int iRandom)
+ {
+ int iRet = -1;
+ Semaphore sem = null;
+ if (iRandom > 0)
+ {
+ //TestFramework.GlobalData intl = new TestFramework.GlobalData();
+ //semName = intl.GetString(iRandom, iRandom).Replace(@"\", "");
+ Console.WriteLine("WARNING: Random name generation is disabled");
+ }
+ bool bRet=true;
+ try
+ {
+ using (sem = new Semaphore(initalValue, maxValue, semName, out bRet))
+ {
+ if(bRet)
+ Console.WriteLine("Semaphore was created!");
+ }
+ }
+ catch(ArgumentException)
+ {
+ // Expected
+ if(bRet)
+ iRet = 100;
+ else
+ Console.WriteLine("Returned FALSE");
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg3.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg3.csproj
new file mode 100644
index 0000000000..3425fec490
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphorectorneg3.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/iCount:-2147483647 /mCount:-2147483647 /semName:null</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreCtorNeg3.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg1.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg1.cs
new file mode 100644
index 0000000000..d6bbb165a4
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg1.cs
@@ -0,0 +1,38 @@
+// 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.Threading;
+
+class OpenSemaphoreNeg
+{
+ public static int Main()
+ {
+ OpenSemaphoreNeg osn = new OpenSemaphoreNeg();
+ return osn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Semaphore sem;
+ try
+ {
+ sem = Semaphore.OpenExisting(Common.GetUniqueName());
+ }
+ catch (WaitHandleCannotBeOpenedException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg1.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg1.csproj
new file mode 100644
index 0000000000..583c32fad5
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg1.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreOpenNeg1.cs" />
+ <Compile Include="..\SemaphoreCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg2.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg2.cs
new file mode 100644
index 0000000000..a5ea955c49
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg2.cs
@@ -0,0 +1,40 @@
+// 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.Threading;
+
+class OpenSemaphoreNeg
+{
+ public static int Main()
+ {
+ OpenSemaphoreNeg osn = new OpenSemaphoreNeg();
+ return osn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Semaphore sem;
+ try
+ {
+ using (sem = Semaphore.OpenExisting(""))
+ {
+ }
+ }
+ catch (ArgumentException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg2.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg2.csproj
new file mode 100644
index 0000000000..09f248bbfe
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg2.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreOpenNeg2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg3.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg3.cs
new file mode 100644
index 0000000000..6194222068
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg3.cs
@@ -0,0 +1,38 @@
+// 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.Threading;
+
+class OpenSemaphoreNeg
+{
+ public static int Main()
+ {
+ OpenSemaphoreNeg osn = new OpenSemaphoreNeg();
+ return osn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Semaphore sem;
+ try
+ {
+ sem = Semaphore.OpenExisting(null);
+ }
+ catch (ArgumentNullException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg3.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg3.csproj
new file mode 100644
index 0000000000..6eb196f8f2
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg3.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreOpenNeg3.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg4.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg4.cs
new file mode 100644
index 0000000000..45f5db5ca9
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg4.cs
@@ -0,0 +1,39 @@
+// 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.Threading;
+
+class OpenSemaphoreNeg
+{
+ public static int Main()
+ {
+ OpenSemaphoreNeg osn = new OpenSemaphoreNeg();
+ return osn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Semaphore sem;
+ try
+ {
+ String mySem = null;
+ sem = Semaphore.OpenExisting(mySem);
+ }
+ catch (ArgumentNullException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg4.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg4.csproj
new file mode 100644
index 0000000000..b3c51ac680
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg4.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreOpenNeg4.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg5.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg5.cs
new file mode 100644
index 0000000000..998c26179b
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg5.cs
@@ -0,0 +1,42 @@
+// 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.Threading;
+
+class OpenSemaphoreNeg
+{
+ public static int Main()
+ {
+ OpenSemaphoreNeg osn = new OpenSemaphoreNeg();
+ return osn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ string sName = Common.GetUniqueName();
+ // open a closed semaphore
+ try
+ {
+ using (Semaphore sem1 = new Semaphore(10, 10, sName))
+ {
+ }
+ Semaphore sem2 = Semaphore.OpenExisting(sName);
+ }
+ catch (WaitHandleCannotBeOpenedException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg5.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg5.csproj
new file mode 100644
index 0000000000..334bd7909d
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg5.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreOpenNeg5.cs" />
+ <Compile Include="..\SemaphoreCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg6.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg6.cs
new file mode 100644
index 0000000000..282c5c43d2
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg6.cs
@@ -0,0 +1,42 @@
+// 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.Threading;
+
+class OpenSemaphoreNeg
+{
+ public static int Main()
+ {
+ OpenSemaphoreNeg osn = new OpenSemaphoreNeg();
+ return osn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ string sName = Common.GetUniqueName();
+ // open a semaphore with the same name as a mutex
+ Mutex mu = new Mutex(false, sName);
+ try
+ {
+ using (Semaphore sem = Semaphore.OpenExisting(sName))
+ {
+ }
+ }
+ catch (WaitHandleCannotBeOpenedException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg6.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg6.csproj
new file mode 100644
index 0000000000..0449e31666
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg6.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreOpenNeg6.cs" />
+ <Compile Include="..\SemaphoreCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg7.cs b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg7.cs
new file mode 100644
index 0000000000..ff36723e14
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg7.cs
@@ -0,0 +1,43 @@
+// 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.Threading;
+
+class OpenSemaphoreNeg
+{
+ public static int Main()
+ {
+ OpenSemaphoreNeg osn = new OpenSemaphoreNeg();
+ return osn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ string sName = Common.GetUniqueName();
+ // open a semaphore with the same name as a mutex
+ EventWaitHandle ewh = new EventWaitHandle(false,
+ EventResetMode.AutoReset, sName);
+ try
+ {
+ using(Semaphore sem = Semaphore.OpenExisting(sName))
+ {
+ }
+ }
+ catch (WaitHandleCannotBeOpenedException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg7.csproj b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg7.csproj
new file mode 100644
index 0000000000..bd94570b09
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/ctoropen/semaphoreopenneg7.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemaphoreOpenNeg7.cs" />
+ <Compile Include="..\SemaphoreCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/semaphorecommon.cs b/tests/src/baseservices/threading/semaphore/semaphorecommon.cs
new file mode 100644
index 0000000000..11f23caddb
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/semaphorecommon.cs
@@ -0,0 +1,36 @@
+// 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.Threading;
+
+class Common
+{
+ public static string GenerateUnicodeString(int iNumChars)
+ {
+ Random rand = new Random();
+ string semName = string.Empty;
+ string semNameNum = string.Empty;
+ for (int i = 0; i < iNumChars; i++)
+ {
+ char c = '\\';
+ while (c == '\\')
+ {
+ c = (char)rand.Next(Char.MinValue, Char.MaxValue);
+ }
+ semNameNum += ((int)c).ToString() + ";";
+ semName += c;
+ }
+ // write to output
+ Console.WriteLine("Unicode string: " + semNameNum);
+ return semName;
+ }
+
+ public static string GetUniqueName()
+ {
+ string sName = Guid.NewGuid().ToString();
+ Console.WriteLine("Name created: " + sName);
+ return sName;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/unit/semdemo.cs b/tests/src/baseservices/threading/semaphore/unit/semdemo.cs
new file mode 100644
index 0000000000..9dc502f0f1
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/unit/semdemo.cs
@@ -0,0 +1,88 @@
+// 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.Threading;
+
+class Test
+{
+ private Semaphore sem = null;
+ private const int numIterations = 1;
+ private const int numThreads = 10;
+ private int m_success;
+
+ static int Main()
+ {
+ Test t = new Test();
+ t.RunTest();
+ return t.CheckRet();
+
+ }
+
+ private void RunTest()
+ {
+ Semaphore s = new Semaphore(3,3);
+ sem = s;
+
+ Thread[] threads =new Thread[numThreads];
+
+ // Create the threads that will use the protected resource.
+ for(int i = 0; i < numThreads; i++)
+ {
+ threads[i] = new Thread(new ThreadStart(this.MyThreadProc));
+ threads[i].Name = String.Format("Thread{0}", i + 1);
+ threads[i].Start();
+ }
+
+ // The main thread exits, but the application continues to
+ // run until all foreground threads have exited.
+
+ for(int i =0; i< numThreads; i++) {
+ threads[i].Join();
+ }
+ }
+
+ private void MyThreadProc()
+ {
+ for(int i = 0; i < numIterations; i++)
+ {
+ UseResource();
+ }
+ }
+
+ private int CheckRet()
+ {
+ Console.WriteLine(m_success == numThreads ? "Test Passed":"Test Failed");
+ return (m_success == numThreads ? 100:-1);
+ }
+
+ private void Success()
+ {
+ Interlocked.Increment(ref m_success);
+ }
+
+ // This method represents a resource that must be synchronized
+ // so that only one thread at a time can enter.
+ private void UseResource()
+ {
+ // Wait until it is safe to enter.
+ sem.WaitOne();
+
+ Console.WriteLine("{0} has entered the protected area",
+ Thread.CurrentThread.Name);
+
+ // Place code to access non-reentrant resources here.
+
+ // Simulate some work.
+ Thread.Sleep(500);
+ Success();
+ Console.WriteLine("{0} is leaving the protected area\r\n",
+ Thread.CurrentThread.Name);
+
+ // Release the Mutex.
+ sem.Release();
+
+ }
+}
diff --git a/tests/src/baseservices/threading/semaphore/unit/semdemo.csproj b/tests/src/baseservices/threading/semaphore/unit/semdemo.csproj
new file mode 100644
index 0000000000..ffcc17e927
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/unit/semdemo.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemDemo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/semaphore/unit/semtest.cs b/tests/src/baseservices/threading/semaphore/unit/semtest.cs
new file mode 100644
index 0000000000..599f864927
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/unit/semtest.cs
@@ -0,0 +1,190 @@
+// 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.Threading;
+
+class TestSemaphore
+{
+ const int intialCount = 10;
+ const int maximumCount = 10;
+
+ int successes;
+ int failures;
+ int expected;
+
+ public TestSemaphore()
+ {
+ successes = 0;
+ failures = 0;
+ expected = 8;
+ }
+
+ static int Main()
+ {
+ TestSemaphore myTest = new TestSemaphore();
+ myTest.NegativeTest();
+
+ myTest.FuncTest1();
+ myTest.FuncTest2();
+
+ myTest.FuncTest3();
+
+ return (myTest.CheckSuccess());
+ }
+
+ private int CheckSuccess()
+ {
+ if(successes == expected && failures == 0)
+ return 100;
+ return -1;
+ }
+
+ private void Failure(string message)
+ {
+ Console.WriteLine(message);
+ failures++;
+ }
+ private void Success()
+ {
+ successes++;
+ }
+
+ public void NegativeTest() {
+ try {
+ new Semaphore(-1, 0);
+ Failure("new Semaphore(-1, 0) Expected Exception is not thrown");
+ }
+ catch(ArgumentOutOfRangeException) {
+ Success();
+ }
+ catch {
+ Failure("UnExpected Exception thrown");
+ }
+
+ try {
+ new Semaphore(0, -1);
+ Failure("new Semaphore(0, -1) Expected Exception is not thrown");
+ }
+ catch(ArgumentOutOfRangeException) {
+ Success();
+ }
+ catch {
+ Failure("UnExpected Exception thrown");
+ }
+
+ try {
+ new Semaphore(1, 0);
+ Failure("new Semaphore(1, 0) Expected Exception is not thrown");
+ }
+ catch(ArgumentException) {
+ Success();
+ }
+ catch {
+ Failure("UnExpected Exception thrown");
+ }
+
+ }
+
+ public void FuncTest1() {
+ using (Semaphore sem = new Semaphore(intialCount, maximumCount))
+ {
+ sem.WaitOne();
+ int previousCount = sem.Release();
+ Console.WriteLine("Previous Count is {0}", previousCount);
+ if(previousCount != intialCount -1) {
+ Failure("Previous Count is not correct");
+ }
+ else
+ Success();
+
+ try {
+ sem.Release();
+ Failure("Expected Exception is not thrown");
+ }
+ catch(SemaphoreFullException) {
+ Success();
+ }
+ }
+
+ }
+
+ public void FuncTest2() {
+ using (Semaphore sem2 = new Semaphore(intialCount, maximumCount, "Semaphore_TESTSEM"))
+ {
+ bool createdNew;
+ using (Semaphore sem3 = new Semaphore(intialCount, maximumCount, "Semaphore_TESTSEM", out createdNew))
+ {
+ if( createdNew ) {
+ Failure("Error: we are not expecting a new semaphore here");
+ }
+ else
+ Success();
+ }
+
+ using (Semaphore sem4 = Semaphore.OpenExisting("Semaphore_TESTSEM"))
+ {
+ sem4.WaitOne();
+ sem4.WaitOne();
+ int previousCount = sem4.Release(2);
+ Console.WriteLine("Previous Count is {0}", previousCount);
+ if(previousCount != intialCount -2) {
+ Failure("Previous Count is not correct");
+ }
+ else
+ Success();
+ }
+ }
+ }
+
+ public void FuncTest3() {
+
+ Thread t = new Thread(new ThreadStart(Create));
+ Thread t2 = new Thread(new ThreadStart(Open));
+ __flag = false;
+ t.Start();
+ t2.Start();
+ t.Join();
+ t2.Join();
+
+
+ }
+ public bool __flag;
+
+ public void Create()
+ {
+ using (Semaphore sem = new Semaphore(intialCount, maximumCount, "Semaphore_TESTSEMOPEN"))
+ {
+ __flag = true;
+ while(__flag)
+ Thread.Sleep(0);
+ }
+ }
+
+ public void Open()
+ {
+ Semaphore sem4;
+ try{
+ while(!__flag)
+ Thread.Sleep(0);
+ using (sem4 = Semaphore.OpenExisting("Semaphore_TESTSEMOPEN"))
+ {
+ __flag = false;
+ Console.WriteLine("Opened on new thread");
+ Success();
+ sem4.WaitOne();
+ sem4.WaitOne();
+ }
+ }
+ catch(Exception e)
+ {
+ Failure(e.ToString());
+ }
+ finally
+ {
+ __flag = false;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/semaphore/unit/semtest.csproj b/tests/src/baseservices/threading/semaphore/unit/semtest.csproj
new file mode 100644
index 0000000000..7172597376
--- /dev/null
+++ b/tests/src/baseservices/threading/semaphore/unit/semtest.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="SemTest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/stress/sudoku/Stack.csproj b/tests/src/baseservices/threading/stress/sudoku/Stack.csproj
new file mode 100644
index 0000000000..d73f32607f
--- /dev/null
+++ b/tests/src/baseservices/threading/stress/sudoku/Stack.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="stack.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/stress/sudoku/SudokuInterfaces.csproj b/tests/src/baseservices/threading/stress/sudoku/SudokuInterfaces.csproj
new file mode 100644
index 0000000000..d0a6268dde
--- /dev/null
+++ b/tests/src/baseservices/threading/stress/sudoku/SudokuInterfaces.csproj
@@ -0,0 +1,46 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="isudokuboard.cs" />
+ <Compile Include="isudokugenerator.cs" />
+ <Compile Include="isudokusolver.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/stress/sudoku/isudokuboard.cs b/tests/src/baseservices/threading/stress/sudoku/isudokuboard.cs
new file mode 100644
index 0000000000..101f4d1919
--- /dev/null
+++ b/tests/src/baseservices/threading/stress/sudoku/isudokuboard.cs
@@ -0,0 +1,25 @@
+// 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.
+// Author: JeffSchw
+// Date: 2/21/2006
+
+//Interface for the Board
+//The Board returns pieces currently held, including the pieces that have been guessed so far.
+
+using System;
+using System.Collections;
+
+public interface ISudokuBoard<T>
+
+{
+ int Dimension{get;} //Returns the Board dimension (since its always sq., only one value is returned)
+ IEnumerable Tracer{get;} //Trace functionality for debugging
+ bool PopulateBoard(T[,] rawData); //Populates the Board with generated puzzle
+ T[] GetRow(int xcoord); //Returns the Row values for given co-ords
+ T[] GetCol(int ycoord); //Returns the Column values for given co-ords
+ T[] GetShortRegion(int xcoord, int ycoord); //Returns the 3x3 matrix for given co-ords
+ bool SetValue(int xcoord, int ycoord, T value); //Sets Value for a given set of co-ordinates
+ T GetValue(int xcoord, int ycoord); //Returns Value for a given set of co-ordinates
+ bool Clear(); //clears only user pieces
+}
diff --git a/tests/src/baseservices/threading/stress/sudoku/isudokugenerator.cs b/tests/src/baseservices/threading/stress/sudoku/isudokugenerator.cs
new file mode 100644
index 0000000000..cd171a3695
--- /dev/null
+++ b/tests/src/baseservices/threading/stress/sudoku/isudokugenerator.cs
@@ -0,0 +1,21 @@
+// 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.
+// Author: JeffSchw
+// Date: 2/21/2006
+//
+// The SudokuGenerator should produce a valid Sudoku board.
+// Valid Sudoku boards have the following properties:
+// 1. Are solvable (ie. have a solution)
+// 2. Are square (ie. height and width are the same)
+// 3. Dimensions have an integral root (ie. the sqrt of the width is integral)
+// 4. The board is broken down into regions, rows, and columns. Each region/row/column
+// must be able to contian 1-9 with no duplicates.
+
+using System;
+
+public interface ISudokuGenerator<T>
+{
+ // generate a valid sudoku board. Allow for varying the difficultiy (0-9)
+ T[,] Generate(int dimension, int difficulty, int randSeed);
+}
diff --git a/tests/src/baseservices/threading/stress/sudoku/isudokusolver.cs b/tests/src/baseservices/threading/stress/sudoku/isudokusolver.cs
new file mode 100644
index 0000000000..8d5c8450b4
--- /dev/null
+++ b/tests/src/baseservices/threading/stress/sudoku/isudokusolver.cs
@@ -0,0 +1,18 @@
+// 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.
+// Author: SneshaA
+// Date: 3/03/2006
+
+//Interface for the Solver
+//Solver guesses pieces to be placed on the Board
+
+using System;
+
+public interface ISudokuSolver<T>
+{
+ ISudokuBoard<int> Board {set;}
+ bool Guess{get; set;} //Sets Solver with Guess token (since only one solver can guess for a given board)
+ void Solve(); //Solves given Board
+ int Seed{get; set;} //use default, if check for set returns false
+}
diff --git a/tests/src/baseservices/threading/stress/sudoku/stack.cs b/tests/src/baseservices/threading/stress/sudoku/stack.cs
new file mode 100644
index 0000000000..96356a5e75
--- /dev/null
+++ b/tests/src/baseservices/threading/stress/sudoku/stack.cs
@@ -0,0 +1,105 @@
+// 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.
+/***************************
+ * Stack.cs
+ * Author: Alina Popa
+ * Date: 11/5/2008
+ * Description: Simple stack class that holds items of type T and has the following methods:
+ * - Push
+ * - Pop
+ * - Peek
+ * - GetItemAt(index) -- for iterating
+ **************************/
+
+using System;
+
+public class Stack<T>
+{
+ private const int DEFAULT_CAPACITY = 30;
+ private T[] objArray;
+ private int capacity;
+ private int size;
+
+ public Stack(int initialCapacity)
+ {
+ if (initialCapacity <= 0)
+ throw new System.Exception("Stack initial capacity should be a positive number");
+
+ objArray = new T[initialCapacity];
+ size = 0;
+ capacity = initialCapacity;
+ }
+
+ public Stack()
+ {
+ objArray = new T[DEFAULT_CAPACITY];
+ size = 0;
+ capacity = DEFAULT_CAPACITY;
+ }
+
+ //Put item at the end
+ public void Push(T item)
+ {
+ if(size == capacity)
+ {
+ ExpandArray();
+ }
+ objArray[size] = item;
+ size ++;
+ }
+
+ //Pop the last item
+ public T Pop()
+ {
+ if (size <= 0)
+ throw new System.Exception("Empty stack");
+
+ size--;
+ return objArray[size];
+ }
+
+ //Get the last item, without removing it from stack
+ public T Peek()
+ {
+ if (size <= 0)
+ throw new System.Exception("Empty stack");
+
+ return objArray[size-1];
+ }
+
+ public int Count
+ {
+ get
+ {
+ return size;
+ }
+ }
+
+ //Returns the item in a given position
+ public T GetItemAt(int index)
+ {
+ if ((index < 0) || (index > size - 1))
+ {
+ throw new System.Exception("Invalid index");
+ }
+
+ return objArray[index];
+ }
+
+ //Doubles the capacity of the array
+ private void ExpandArray()
+ {
+ int newCapacity = 2 * capacity;
+ T[] newArray = new T[newCapacity];
+
+ //copy objArray in newArray
+ for (int i = 0; i < capacity; i++)
+ {
+ newArray[i] = objArray[i];
+ }
+ objArray = newArray;
+ capacity = newCapacity;
+ }
+}
+
diff --git a/tests/src/baseservices/threading/threadpool/bindhandle/bindhandle1.cs b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandle1.cs
new file mode 100644
index 0000000000..b0fe11adc9
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandle1.cs
@@ -0,0 +1,63 @@
+// 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.Threading;
+using System.IO;
+using System.Runtime.InteropServices;
+using Microsoft.Win32.SafeHandles;
+
+/// <summary>
+/// Verifies passing an invalid handle (not overlapped) to BindHandle works as expected
+/// </summary>
+class BindHandle1
+{
+ public static int Main(string[] args)
+ {
+ return (new BindHandle1().RunTest());
+ }
+
+ [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ public static extern IntPtr CreateFile(String FileName, uint Access, uint Share, int Atts, uint Dispo, uint Flags, int Template);
+
+
+ int RunTest()
+ {
+ try
+ {
+ try
+ {
+ using (SafeFileHandle sfh = new SafeFileHandle(CreateFile("test.txt", 0x40000000, 0, 0, 2, 0x40000000, 0), true))
+ {
+ if (ThreadPool.BindHandle(sfh))
+ {
+ Console.WriteLine("BindHandle call succeeded");
+ }
+ else
+ {
+ Console.WriteLine("Unexpected: BindHandle call failed");
+ return (98);
+ }
+
+ Console.WriteLine("Test passed");
+ return (100);
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Unexpected exception: {0}", ex);
+ return (98);
+ }
+ }
+ finally
+ {
+ if (File.Exists("test.txt"))
+ {
+ File.Delete("test.txt");
+ }
+ }
+ }
+
+
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/bindhandle/bindhandle1.csproj b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandle1.csproj
new file mode 100644
index 0000000000..72a4521295
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandle1.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="BindHandle1.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid.cs b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid.cs
new file mode 100644
index 0000000000..a388d6c671
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid.cs
@@ -0,0 +1,41 @@
+// 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.Threading;
+using Microsoft.Win32.SafeHandles;
+
+class BindHandleInvalid
+{
+ public static int Main(string[] args)
+ {
+ return (new BindHandleInvalid().RunTest());
+ }
+
+ int RunTest()
+ {
+ SafeFileHandle sfh = new SafeFileHandle(IntPtr.Zero, false);
+
+ try
+ {
+ ThreadPool.BindHandle(sfh);
+ }
+ catch (Exception ex)
+ {
+ if (ex.ToString().IndexOf("0x80070006") != -1) // E_HANDLE, we can't access hresult
+ {
+ Console.WriteLine("Test passed");
+ return (100);
+ }
+ else
+ {
+ Console.WriteLine("Got wrong error: {0}", ex);
+ }
+ }
+ Console.WriteLine("Didn't get argument null exception");
+ return (99);
+ }
+
+
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid.csproj b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid.csproj
new file mode 100644
index 0000000000..1d048bc276
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="BindHandleInvalid.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid3.cs b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid3.cs
new file mode 100644
index 0000000000..519c843523
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid3.cs
@@ -0,0 +1,62 @@
+// 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.Threading;
+using System.IO;
+using System.Runtime.InteropServices;
+using Microsoft.Win32.SafeHandles;
+
+/// <summary>
+/// Verifies passing an invalid handle (not overlapped) to BindHandle works as expected
+/// </summary>
+class BindHandleInvalid3
+{
+ public static int Main(string[] args)
+ {
+ return (new BindHandleInvalid3().RunTest());
+ }
+
+ [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ public static extern IntPtr CreateFile(String FileName, uint Access, uint Share, int Atts, uint Dispo, uint Flags, int Template);
+
+
+ int RunTest()
+ {
+ try
+ {
+ try
+ {
+ using (SafeFileHandle sfh = new SafeFileHandle(CreateFile("test.txt", 0x40000000, 0, 0, 2, 0x80, 0), true))
+ {
+
+ ThreadPool.BindHandle(sfh);
+ }
+ }
+ catch (Exception ex)
+ {
+ if (ex.ToString().IndexOf("0x80070057") != -1) // E_INVALIDARG, the handle isn't overlapped
+ {
+ Console.WriteLine("Test passed");
+ return (100);
+ }
+ else
+ {
+ Console.WriteLine("Got wrong error: {0}", ex);
+ }
+ }
+ }
+ finally
+ {
+ if (File.Exists("test.txt"))
+ {
+ File.Delete("test.txt");
+ }
+ }
+ Console.WriteLine("Didn't get argument null exception");
+ return (99);
+ }
+
+
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid3.csproj b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid3.csproj
new file mode 100644
index 0000000000..ff9a2c12b1
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid3.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="BindHandleInvalid3.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid4.cs b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid4.cs
new file mode 100644
index 0000000000..ebfde369f5
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid4.cs
@@ -0,0 +1,57 @@
+// 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.Threading;
+using System.IO;
+using System.Runtime.InteropServices;
+using Microsoft.Win32.SafeHandles;
+
+/// <summary>
+/// Verifies passing an invalid handle (not overlapped) to BindHandle works as expected
+/// </summary>
+class BindHandleInvalid3
+{
+ public static int Main(string[] args)
+ {
+ return (new BindHandleInvalid3().RunTest());
+ }
+
+ int RunTest()
+ {
+ try
+ {
+ try
+ {
+ using (FileStream fs1 = new FileStream("test.txt", FileMode.Create))
+ {
+ ThreadPool.BindHandle(fs1.SafeFileHandle);
+ }
+ }
+ catch (Exception ex)
+ {
+ if (ex.ToString().IndexOf("0x80070057") != -1) // E_INVALIDARG, the handle isn't overlapped
+ {
+ Console.WriteLine("Test passed");
+ return (100);
+ }
+ else
+ {
+ Console.WriteLine("Got wrong error: {0}", ex);
+ }
+ }
+ }
+ finally
+ {
+ if (File.Exists("test.txt"))
+ {
+ File.Delete("test.txt");
+ }
+ }
+ Console.WriteLine("Didn't get argument null exception");
+ return (99);
+ }
+
+
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid4.csproj b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid4.csproj
new file mode 100644
index 0000000000..2829fd9944
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid4.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="BindHandleInvalid4.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid5.cs b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid5.cs
new file mode 100644
index 0000000000..64f55a1750
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid5.cs
@@ -0,0 +1,63 @@
+// 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.Threading;
+using System.IO;
+using System.Runtime.InteropServices;
+using Microsoft.Win32.SafeHandles;
+
+/// <summary>
+/// Verifies passing an invalid handle (not overlapped) to BindHandle works as expected
+/// </summary>
+class BindHandleInvalid3
+{
+ public static int Main(string[] args)
+ {
+ return (new BindHandleInvalid3().RunTest());
+ }
+
+ int RunTest()
+ {
+ try
+ {
+ try
+ {
+ using (FileStream fs1 = new FileStream("test.txt",
+ FileMode.Create,
+ FileAccess.ReadWrite,
+ FileShare.ReadWrite,
+ 0x10000,
+ true))
+ {
+
+ ThreadPool.BindHandle(fs1.SafeFileHandle);
+ }
+ }
+ catch (Exception ex)
+ {
+ if (ex.ToString().IndexOf("0x80070057") != -1) // E_INVALIDARG, we've already bound the handle.
+ {
+ Console.WriteLine("Test passed");
+ return (100);
+ }
+ else
+ {
+ Console.WriteLine("Got wrong error: {0}", ex);
+ }
+ }
+ }
+ finally
+ {
+ if (File.Exists("test.txt"))
+ {
+ File.Delete("test.txt");
+ }
+ }
+ Console.WriteLine("Didn't get argument null exception");
+ return (99);
+ }
+
+
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid5.csproj b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid5.csproj
new file mode 100644
index 0000000000..4ec2074e30
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid5.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="BindHandleInvalid5.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid6.cs b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid6.cs
new file mode 100644
index 0000000000..7700cc28c1
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid6.cs
@@ -0,0 +1,78 @@
+// 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.Threading;
+using System.IO;
+using System.Runtime.InteropServices;
+using Microsoft.Win32.SafeHandles;
+
+/// <summary>
+/// Verifies passing an invalid handle (not overlapped) to BindHandle works as expected
+/// </summary>
+class BindHandle1
+{
+ public static int Main(string[] args)
+ {
+ return (new BindHandle1().RunTest());
+ }
+
+ [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ public static extern IntPtr CreateFile(String FileName, uint Access, uint Share, int Atts, uint Dispo, uint Flags, int Template);
+
+ int RunTest()
+ {
+ try
+ {
+ try
+ {
+ using (SafeFileHandle sfh = new SafeFileHandle(CreateFile("test.txt", 0x40000000, 0, 0, 2, 0x40000000, 0), true))
+ {
+
+ try
+ {
+ if (ThreadPool.BindHandle(sfh))
+ {
+ Console.WriteLine("BindHandle call succeeded");
+ }
+ else
+ {
+ Console.WriteLine("Unexpected: BindHandle call failed");
+ return (98);
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Unexpected exception on 1st call: {0}", e);
+ return (92);
+ }
+
+ ThreadPool.BindHandle(sfh);
+ }
+ }
+ catch (Exception ex)
+ {
+ if (ex.ToString().IndexOf("0x80070057") != -1) // E_INVALIDARG, we've already bound the handle.
+ {
+ Console.WriteLine("Test passed");
+ return (100);
+ }
+ else
+ {
+ Console.WriteLine("Got wrong error: {0}", ex);
+ }
+ }
+ }
+ finally
+ {
+ if (File.Exists("test.txt"))
+ {
+ File.Delete("test.txt");
+ }
+ }
+ return (99);
+ }
+
+
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid6.csproj b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid6.csproj
new file mode 100644
index 0000000000..d1e9146526
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandleinvalid6.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="BindHandleInvalid6.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/bindhandle/bindhandlenull.cs b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandlenull.cs
new file mode 100644
index 0000000000..3eaee3d126
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandlenull.cs
@@ -0,0 +1,33 @@
+// 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.Threading;
+
+class BindHandleNull
+{
+ public static int Main(string[] args)
+ {
+ return (new BindHandleNull().RunTest());
+ }
+
+ int RunTest()
+ {
+ try
+ {
+ ThreadPool.BindHandle(null);
+ }
+ catch (ArgumentNullException)
+ {
+ Console.WriteLine("Test passed");
+ return (100);
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected: {0}", e);
+ return (98);
+ }
+ return (97);
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/bindhandle/bindhandlenull.csproj b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandlenull.csproj
new file mode 100644
index 0000000000..9442e83cc5
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/bindhandle/bindhandlenull.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="BindHandleNull.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/ctorchk/ctorchk.cs b/tests/src/baseservices/threading/threadpool/ctorchk/ctorchk.cs
new file mode 100644
index 0000000000..957fe73470
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/ctorchk/ctorchk.cs
@@ -0,0 +1,30 @@
+// 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.Threading;
+using System.Reflection;
+
+class TestMonitor
+{
+ public static int Main()
+ {
+ // This will look for any private constructor.
+ // There shouldn't be one in Whidbey.
+ ConstructorInfo[] m = typeof(ThreadPool).GetConstructors(
+ BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public );
+ Console.WriteLine(m.Length);
+
+ if(m.Length > 0)
+ {
+ Console.WriteLine("Test FAILED!");
+ return 1;
+ }
+ else
+ {
+ Console.WriteLine("Test PASSED!");
+ return 100;
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/ctorchk/ctorchk.csproj b/tests/src/baseservices/threading/threadpool/ctorchk/ctorchk.csproj
new file mode 100644
index 0000000000..dd246958b3
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/ctorchk/ctorchk.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="CtorChk.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/unregister/regression_749068.cs b/tests/src/baseservices/threading/threadpool/unregister/regression_749068.cs
new file mode 100644
index 0000000000..4f9deaab3b
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/unregister/regression_749068.cs
@@ -0,0 +1,137 @@
+// 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.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Threading;
+
+/************************
+ * Regression test for bug Bug 749068:WatsonCrash: coreclr.dll!Thread::DoAppropriateWaitWorker -- APPLICATION_HANG_BlockedOn_EventHandle c0000194
+ *
+ * Should be run with complus_GCStress=3
+ *
+ * During GC, no IO completion threads are created. So if there was no IO completion thread to begin with,
+ * there will be no threads monitoring the event which signals to schedule the corresponding callback,
+ * this blocks whatever code, which is waiting for the callback to finish or unregister it, indefinitely
+ *
+ ************************/
+namespace Prog
+{
+ class Callback
+ {
+ ManualResetEvent sessionNotification;
+ RegisteredWaitHandle sessionRegisteredWait;
+ public Callback()
+ {
+ this.sessionRegisteredWait = null;
+ this.sessionNotification = null;
+ }
+ public void ServiceCallbackOnPositionAvailable(Object state, bool timedOut)
+ {
+
+ if (this.sessionRegisteredWait == null)
+ {
+ this.sessionNotification.Reset();
+ this.sessionRegisteredWait.Unregister(null);
+
+ this.sessionRegisteredWait =
+ ThreadPool.RegisterWaitForSingleObject(this.sessionNotification,
+ ServiceCallbackOnPositionAvailable,
+ this, /* object state */
+ -1, /* INFINITE */
+ true /* ExecuteOnlyOnce */);
+
+ }
+ Console.WriteLine("callback running");
+
+ }
+ public void call()
+ {
+ if (this.sessionNotification != null)
+ this.sessionNotification.Set();
+ }
+ public void register()
+ {
+
+
+ this.sessionNotification = new ManualResetEvent(false);
+
+ this.sessionRegisteredWait = ThreadPool.RegisterWaitForSingleObject(
+ this.sessionNotification,
+ ServiceCallbackOnPositionAvailable,
+ this, /* object state */
+ -1, /* INFINITE */
+ true /* ExecuteOnlyOnce */);
+
+
+ }
+ public bool unregister()
+ {
+ ManualResetEvent callbackThreadComplete = new ManualResetEvent(false);
+ int timeToWait = 5000; //milliseconds
+ System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
+ sw.Start();
+ if (this.sessionRegisteredWait != null)
+ {
+ if (this.sessionRegisteredWait.Unregister(callbackThreadComplete))
+ {
+ Console.WriteLine("waiting on succesful unregister");
+ callbackThreadComplete.WaitOne(timeToWait);
+ }
+ }
+ this.sessionRegisteredWait = null;
+
+ long elapsed = sw.ElapsedMilliseconds;
+ Console.WriteLine("Elapsed: {0} millisec", elapsed);
+ if (elapsed >= timeToWait)
+ {
+ Console.WriteLine("Error. Callback was not signaled");
+ return false;
+ }
+ else
+ {
+ Console.WriteLine("Success");
+ return true;
+ }
+
+
+
+
+ }
+
+
+ }
+
+
+ class Program
+ {
+
+ static int Main(string[] args)
+ {
+ Callback obj = new Callback();
+
+ Console.WriteLine("start");
+ obj.register();
+
+ obj.call();
+ bool success = obj.unregister();
+
+ Console.WriteLine("end");
+ if (success)
+ {
+ Console.WriteLine("test passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("test failed");
+ return 2;
+ }
+
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/threadpool/unregister/regression_749068.csproj b/tests/src/baseservices/threading/threadpool/unregister/regression_749068.csproj
new file mode 100644
index 0000000000..2a3690e0a9
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/unregister/regression_749068.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="Regression_749068.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/unregister/unregister01.cs b/tests/src/baseservices/threading/threadpool/unregister/unregister01.cs
new file mode 100644
index 0000000000..ad70603379
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/unregister/unregister01.cs
@@ -0,0 +1,64 @@
+// 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.
+
+#region Using directives
+
+
+
+using System;
+
+using System.Collections.Generic;
+
+using System.Text;
+
+using System.Threading;
+
+
+
+#endregion
+
+
+
+namespace UnregisterWaitNativeBug
+{
+ class Program
+ {
+ public int ret = 0;
+ RegisteredWaitHandle[] regWait;
+ static int Main(string[] args)
+ {
+ Program p = new Program();
+ p.Run();
+ Console.WriteLine(100 == p.ret ? "Test Passed" : "Test Failed");
+ return p.ret;
+ }
+ public void Run()
+ {
+ int size = 100;
+ AutoResetEvent[] are = new AutoResetEvent[size];
+ regWait = new RegisteredWaitHandle[size];
+
+ for (int i = 0; i < size; i++)
+ {
+ are[i] = new AutoResetEvent(false);
+ regWait[i] = ThreadPool.RegisterWaitForSingleObject((WaitHandle)are[i], new WaitOrTimerCallback(TheCallBack), are[i], -1, false);
+ }
+
+ for (int i = 0; i < size; i++)
+ {
+ are[i].Set();
+ }
+ Thread.Sleep(1000);
+ for (int i = 0; i < size; i++)
+ {
+ regWait[i].Unregister(are[i]);
+ }
+ }
+ public void TheCallBack(object foo, bool state)
+ {
+ Interlocked.Increment(ref ret);
+ }
+ }
+}
+
diff --git a/tests/src/baseservices/threading/threadpool/unregister/unregister01.csproj b/tests/src/baseservices/threading/threadpool/unregister/unregister01.csproj
new file mode 100644
index 0000000000..ab55a1deee
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/unregister/unregister01.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="Unregister01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadpool/unregister/unregister03.cs b/tests/src/baseservices/threading/threadpool/unregister/unregister03.cs
new file mode 100644
index 0000000000..6454964f69
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/unregister/unregister03.cs
@@ -0,0 +1,65 @@
+// 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.
+
+#region Using directives
+
+
+
+using System;
+
+using System.Collections.Generic;
+
+using System.Text;
+
+using System.Threading;
+
+
+
+#endregion
+
+
+
+namespace UnregisterWaitNativeBug
+{
+ class Program
+ {
+ public int ret = 0;
+ RegisteredWaitHandle[] regWait;
+ static int Main(string[] args)
+ {
+ Program p = new Program();
+ p.Run();
+ Console.WriteLine(100 == p.ret ? "Test Passed" : "Test Failed");
+ return p.ret;
+ }
+ public void Run()
+ {
+ int size = 100;
+ AutoResetEvent[] are = new AutoResetEvent[size];
+ regWait = new RegisteredWaitHandle[size];
+
+ for (int i = 0; i < size; i++)
+ {
+ are[i] = new AutoResetEvent(false);
+ regWait[i] = ThreadPool.RegisterWaitForSingleObject((WaitHandle)are[i], new WaitOrTimerCallback(TheCallBack), are[i], -1, false);
+ }
+
+ for (int i = 0; i < size; i++)
+ {
+ are[i].Set();
+ are[i] = null;
+ }
+ Thread.Sleep(1000);
+ for (int i = 0; i < size; i++)
+ {
+ regWait[i].Unregister(are[i]);
+ }
+ }
+ public void TheCallBack(object foo, bool state)
+ {
+ Interlocked.Increment(ref ret);
+ }
+ }
+}
+
diff --git a/tests/src/baseservices/threading/threadpool/unregister/unregister03.csproj b/tests/src/baseservices/threading/threadpool/unregister/unregister03.csproj
new file mode 100644
index 0000000000..8c604fded6
--- /dev/null
+++ b/tests/src/baseservices/threading/threadpool/unregister/unregister03.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="Unregister03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadstatic/ThreadStatic01.csproj b/tests/src/baseservices/threading/threadstatic/ThreadStatic01.csproj
new file mode 100644
index 0000000000..5c8207c23d
--- /dev/null
+++ b/tests/src/baseservices/threading/threadstatic/ThreadStatic01.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstatic01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadstatic/ThreadStatic02.csproj b/tests/src/baseservices/threading/threadstatic/ThreadStatic02.csproj
new file mode 100644
index 0000000000..a4463def65
--- /dev/null
+++ b/tests/src/baseservices/threading/threadstatic/ThreadStatic02.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstatic02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadstatic/ThreadStatic03.csproj b/tests/src/baseservices/threading/threadstatic/ThreadStatic03.csproj
new file mode 100644
index 0000000000..c3e334f074
--- /dev/null
+++ b/tests/src/baseservices/threading/threadstatic/ThreadStatic03.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstatic03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadstatic/ThreadStatic04Helper.csproj b/tests/src/baseservices/threading/threadstatic/ThreadStatic04Helper.csproj
new file mode 100644
index 0000000000..42edcbf1d2
--- /dev/null
+++ b/tests/src/baseservices/threading/threadstatic/ThreadStatic04Helper.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstatic04helper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadstatic/ThreadStatic05.csproj b/tests/src/baseservices/threading/threadstatic/ThreadStatic05.csproj
new file mode 100644
index 0000000000..c692c6fa39
--- /dev/null
+++ b/tests/src/baseservices/threading/threadstatic/ThreadStatic05.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstatic05.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadstatic/ThreadStatic06.csproj b/tests/src/baseservices/threading/threadstatic/ThreadStatic06.csproj
new file mode 100644
index 0000000000..9b14b716da
--- /dev/null
+++ b/tests/src/baseservices/threading/threadstatic/ThreadStatic06.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstatic06.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/threadstatic/threadstatic01.cs b/tests/src/baseservices/threading/threadstatic/threadstatic01.cs
new file mode 100644
index 0000000000..f095bae257
--- /dev/null
+++ b/tests/src/baseservices/threading/threadstatic/threadstatic01.cs
@@ -0,0 +1,799 @@
+// 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.
+//Test is checking the ReserveSlot function
+// If someone screws up the function we will end up
+// setting values in the wrong slots and the totals will be wrong
+
+
+using System;
+using System.Threading;
+
+public class Value0
+{
+
+ [ThreadStatic]
+ private static object One= 1;
+ [ThreadStatic]
+ private static object Two= 2;
+ [ThreadStatic]
+ private static object Three= 3;
+ [ThreadStatic]
+ private static object Four= 4;
+ [ThreadStatic]
+ private static object Five= 5;
+ [ThreadStatic]
+ private static object Six= 6;
+ [ThreadStatic]
+ private static object Seven= 7;
+ [ThreadStatic]
+ private static object Eight= 8;
+ [ThreadStatic]
+ private static object Nine= 9;
+ [ThreadStatic]
+ private static object Ten= 10;
+ [ThreadStatic]
+ private static object Eleven= 11;
+ [ThreadStatic]
+ private static object Twelve= 12;
+ [ThreadStatic]
+ private static object Thirteen= 13;
+ [ThreadStatic]
+ private static object Fourteen= 14;
+ [ThreadStatic]
+ private static object Fifteen= 15;
+ [ThreadStatic]
+ private static object Sixteen= 16;
+ [ThreadStatic]
+ private static object Seventeen= 17;
+ [ThreadStatic]
+ private static object Eightteen= 18;
+ [ThreadStatic]
+ private static object Nineteen= 19;
+ [ThreadStatic]
+ private static object Twenty= 20;
+ [ThreadStatic]
+ private static object TwentyOne= 21;
+ [ThreadStatic]
+ private static object TwentyTwo= 22;
+ [ThreadStatic]
+ private static object TwentyThree= 23;
+ [ThreadStatic]
+ private static object TwentyFour= 24;
+ [ThreadStatic]
+ private static object TwentyFive= 25;
+ [ThreadStatic]
+ private static object TwentySix= 26;
+ [ThreadStatic]
+ private static object TwentySeven= 27;
+ [ThreadStatic]
+ private static object TwentyEight= 28;
+ [ThreadStatic]
+ private static object TwentyNine= 29;
+ [ThreadStatic]
+ private static object Thirty= 30;
+ [ThreadStatic]
+ private static object ThirtyOne= 31;
+ [ThreadStatic]
+ private static object ThirtyTwo= 32;
+
+ public bool CheckValues()
+ {
+ if((int)ThirtyTwo != 32)
+ {
+ Console.WriteLine("ThirtySecond spot was incorrect!!!");
+ return false;
+ }
+
+ int value = 0;
+ value = (int)One
+ + (int)Two
+ + (int)Three
+ + (int)Four
+ + (int)Five
+ + (int)Six
+ + (int)Seven
+ + (int)Eight
+ + (int)Nine
+ + (int)Ten
+ + (int)Eleven
+ + (int)Twelve
+ + (int)Thirteen
+ + (int)Fourteen
+ + (int)Fifteen
+ + (int)Sixteen
+ + (int)Seventeen
+ + (int)Eightteen
+ + (int)Nineteen
+ + (int)Twenty
+ + (int)TwentyOne
+ + (int)TwentyTwo
+ + (int)TwentyThree
+ + (int)TwentyFour
+ + (int)TwentyFive
+ + (int)TwentySix
+ + (int)TwentySeven
+ + (int)TwentyEight
+ + (int)TwentyNine
+ + (int)Thirty
+ + (int)ThirtyOne
+ + (int)ThirtyTwo;
+
+ if(value != 528)
+ {
+ Console.WriteLine("Value0 - Wrong values in ThreadStatics!!! {0}",value);
+ return false;
+ }
+ return true;
+ }
+
+}
+
+public class Value1
+{
+
+ [ThreadStatic]
+ private static object One= 1;
+ [ThreadStatic]
+ private static object Two= 2;
+ [ThreadStatic]
+ private static object Three= 3;
+ [ThreadStatic]
+ private static object Four= 4;
+ [ThreadStatic]
+ private static object Five= 5;
+ [ThreadStatic]
+ private static object Six= 6;
+ [ThreadStatic]
+ private static object Seven= 7;
+ [ThreadStatic]
+ private static object Eight= 8;
+ [ThreadStatic]
+ private static object Nine= 9;
+ [ThreadStatic]
+ private static object Ten= 10;
+ [ThreadStatic]
+ private static object Eleven= 11;
+ [ThreadStatic]
+ private static object Twelve= 12;
+ [ThreadStatic]
+ private static object Thirteen= 13;
+ [ThreadStatic]
+ private static object Fourteen= 14;
+ [ThreadStatic]
+ private static object Fifteen= 15;
+ [ThreadStatic]
+ private static object Sixteen= 16;
+ [ThreadStatic]
+ private static object Seventeen= 17;
+ [ThreadStatic]
+ private static object Eightteen= 18;
+ [ThreadStatic]
+ private static object Nineteen= 19;
+ [ThreadStatic]
+ private static object Twenty= 20;
+ [ThreadStatic]
+ private static object TwentyOne= 21;
+ [ThreadStatic]
+ private static object TwentyTwo= 22;
+ [ThreadStatic]
+ private static object TwentyThree= 23;
+ [ThreadStatic]
+ private static object TwentyFour= 24;
+ [ThreadStatic]
+ private static object TwentyFive= 25;
+ [ThreadStatic]
+ private static object TwentySix= 26;
+ [ThreadStatic]
+ private static object TwentySeven= 27;
+ [ThreadStatic]
+ private static object TwentyEight= 28;
+ [ThreadStatic]
+ private static object TwentyNine= 29;
+ [ThreadStatic]
+ private static object Thirty= 30;
+ [ThreadStatic]
+ private static object ThirtyOne= 31;
+ [ThreadStatic]
+ private static object ThirtyTwo= 32;
+
+ public bool CheckValues()
+ {
+ if((int)ThirtyTwo != 32)
+ {
+ Console.WriteLine("ThirtySecond spot was incorrect!!!");
+ return false;
+ }
+
+ int value = 0;
+ value = (int)One
+ + (int)Two
+ + (int)Three
+ + (int)Four
+ + (int)Five
+ + (int)Six
+ + (int)Seven
+ + (int)Eight
+ + (int)Nine
+ + (int)Ten
+ + (int)Eleven
+ + (int)Twelve
+ + (int)Thirteen
+ + (int)Fourteen
+ + (int)Fifteen
+ + (int)Sixteen
+ + (int)Seventeen
+ + (int)Eightteen
+ + (int)Nineteen
+ + (int)Twenty
+ + (int)TwentyOne
+ + (int)TwentyTwo
+ + (int)TwentyThree
+ + (int)TwentyFour
+ + (int)TwentyFive
+ + (int)TwentySix
+ + (int)TwentySeven
+ + (int)TwentyEight
+ + (int)TwentyNine
+ + (int)Thirty
+ + (int)ThirtyOne
+ + (int)ThirtyTwo;
+
+ if(value != 528)
+ {
+ Console.WriteLine("Value1 - Wrong values in ThreadStatics!!! {0}",value);
+ return false;
+ }
+ return true;
+ }
+
+}
+
+public class Value2
+{
+
+ [ThreadStatic]
+ private static object One= 1;
+ [ThreadStatic]
+ private static object Two= 2;
+ [ThreadStatic]
+ private static object Three= 3;
+ [ThreadStatic]
+ private static object Four= 4;
+ [ThreadStatic]
+ private static object Five= 5;
+ [ThreadStatic]
+ private static object Six= 6;
+ [ThreadStatic]
+ private static object Seven= 7;
+ [ThreadStatic]
+ private static object Eight= 8;
+ [ThreadStatic]
+ private static object Nine= 9;
+ [ThreadStatic]
+ private static object Ten= 10;
+ [ThreadStatic]
+ private static object Eleven= 11;
+ [ThreadStatic]
+ private static object Twelve= 12;
+ [ThreadStatic]
+ private static object Thirteen= 13;
+ [ThreadStatic]
+ private static object Fourteen= 14;
+ [ThreadStatic]
+ private static object Fifteen= 15;
+ [ThreadStatic]
+ private static object Sixteen= 16;
+ [ThreadStatic]
+ private static object Seventeen= 17;
+ [ThreadStatic]
+ private static object Eightteen= 18;
+ [ThreadStatic]
+ private static object Nineteen= 19;
+ [ThreadStatic]
+ private static object Twenty= 20;
+ [ThreadStatic]
+ private static object TwentyOne= 21;
+ [ThreadStatic]
+ private static object TwentyTwo= 22;
+ [ThreadStatic]
+ private static object TwentyThree= 23;
+ [ThreadStatic]
+ private static object TwentyFour= 24;
+ [ThreadStatic]
+ private static object TwentyFive= 25;
+ [ThreadStatic]
+ private static object TwentySix= 26;
+ [ThreadStatic]
+ private static object TwentySeven= 27;
+ [ThreadStatic]
+ private static object TwentyEight= 28;
+ [ThreadStatic]
+ private static object TwentyNine= 29;
+ [ThreadStatic]
+ private static object Thirty= 30;
+ [ThreadStatic]
+ private static object ThirtyOne= 31;
+ [ThreadStatic]
+ private static object ThirtyTwo= 32;
+
+ public bool CheckValues()
+ {
+ if((int)ThirtyTwo != 32)
+ {
+ Console.WriteLine("Value2 - ThirtySecond spot was incorrect!!!");
+ return false;
+ }
+
+ int value = 0;
+ value = (int)One
+ + (int)Two
+ + (int)Three
+ + (int)Four
+ + (int)Five
+ + (int)Six
+ + (int)Seven
+ + (int)Eight
+ + (int)Nine
+ + (int)Ten
+ + (int)Eleven
+ + (int)Twelve
+ + (int)Thirteen
+ + (int)Fourteen
+ + (int)Fifteen
+ + (int)Sixteen
+ + (int)Seventeen
+ + (int)Eightteen
+ + (int)Nineteen
+ + (int)Twenty
+ + (int)TwentyOne
+ + (int)TwentyTwo
+ + (int)TwentyThree
+ + (int)TwentyFour
+ + (int)TwentyFive
+ + (int)TwentySix
+ + (int)TwentySeven
+ + (int)TwentyEight
+ + (int)TwentyNine
+ + (int)Thirty
+ + (int)ThirtyOne
+ + (int)ThirtyTwo;
+
+ if(value != 528)
+ {
+ Console.WriteLine("Wrong values in ThreadStatics!!! {0}",value);
+ return false;
+ }
+ return true;
+ }
+}
+
+public class Value3
+{
+
+ [ThreadStatic]
+ private static object One= 1;
+ [ThreadStatic]
+ private static object Two= 2;
+ [ThreadStatic]
+ private static object Three= 3;
+ [ThreadStatic]
+ private static object Four= 4;
+ [ThreadStatic]
+ private static object Five= 5;
+ [ThreadStatic]
+ private static object Six= 6;
+ [ThreadStatic]
+ private static object Seven= 7;
+ [ThreadStatic]
+ private static object Eight= 8;
+ [ThreadStatic]
+ private static object Nine= 9;
+ [ThreadStatic]
+ private static object Ten= 10;
+ [ThreadStatic]
+ private static object Eleven= 11;
+ [ThreadStatic]
+ private static object Twelve= 12;
+ [ThreadStatic]
+ private static object Thirteen= 13;
+ [ThreadStatic]
+ private static object Fourteen= 14;
+ [ThreadStatic]
+ private static object Fifteen= 15;
+ [ThreadStatic]
+ private static object Sixteen= 16;
+ [ThreadStatic]
+ private static object Seventeen= 17;
+ [ThreadStatic]
+ private static object Eightteen= 18;
+ [ThreadStatic]
+ private static object Nineteen= 19;
+ [ThreadStatic]
+ private static object Twenty= 20;
+ [ThreadStatic]
+ private static object TwentyOne= 21;
+ [ThreadStatic]
+ private static object TwentyTwo= 22;
+ [ThreadStatic]
+ private static object TwentyThree= 23;
+ [ThreadStatic]
+ private static object TwentyFour= 24;
+ [ThreadStatic]
+ private static object TwentyFive= 25;
+ [ThreadStatic]
+ private static object TwentySix= 26;
+ [ThreadStatic]
+ private static object TwentySeven= 27;
+ [ThreadStatic]
+ private static object TwentyEight= 28;
+ [ThreadStatic]
+ private static object TwentyNine= 29;
+ [ThreadStatic]
+ private static object Thirty= 30;
+ [ThreadStatic]
+ private static object ThirtyOne= 31;
+ [ThreadStatic]
+ private static object ThirtyTwo= 32;
+
+ public bool CheckValues()
+ {
+ if((int)ThirtyTwo != 32)
+ {
+ Console.WriteLine("Value2 - ThirtySecond spot was incorrect!!!");
+ return false;
+ }
+
+ int value = 0;
+ value = (int)One
+ + (int)Two
+ + (int)Three
+ + (int)Four
+ + (int)Five
+ + (int)Six
+ + (int)Seven
+ + (int)Eight
+ + (int)Nine
+ + (int)Ten
+ + (int)Eleven
+ + (int)Twelve
+ + (int)Thirteen
+ + (int)Fourteen
+ + (int)Fifteen
+ + (int)Sixteen
+ + (int)Seventeen
+ + (int)Eightteen
+ + (int)Nineteen
+ + (int)Twenty
+ + (int)TwentyOne
+ + (int)TwentyTwo
+ + (int)TwentyThree
+ + (int)TwentyFour
+ + (int)TwentyFive
+ + (int)TwentySix
+ + (int)TwentySeven
+ + (int)TwentyEight
+ + (int)TwentyNine
+ + (int)Thirty
+ + (int)ThirtyOne
+ + (int)ThirtyTwo;
+
+ if(value != 528)
+ {
+ Console.WriteLine("Wrong values in ThreadStatics!!! {0}",value);
+ return false;
+ }
+ return true;
+ }
+}
+
+public class Value4
+{
+
+ [ThreadStatic]
+ private static object One= 1;
+ [ThreadStatic]
+ private static object Two= 2;
+ [ThreadStatic]
+ private static object Three= 3;
+ [ThreadStatic]
+ private static object Four= 4;
+ [ThreadStatic]
+ private static object Five= 5;
+ [ThreadStatic]
+ private static object Six= 6;
+ [ThreadStatic]
+ private static object Seven= 7;
+ [ThreadStatic]
+ private static object Eight= 8;
+ [ThreadStatic]
+ private static object Nine= 9;
+ [ThreadStatic]
+ private static object Ten= 10;
+ [ThreadStatic]
+ private static object Eleven= 11;
+ [ThreadStatic]
+ private static object Twelve= 12;
+ [ThreadStatic]
+ private static object Thirteen= 13;
+ [ThreadStatic]
+ private static object Fourteen= 14;
+ [ThreadStatic]
+ private static object Fifteen= 15;
+ [ThreadStatic]
+ private static object Sixteen= 16;
+ [ThreadStatic]
+ private static object Seventeen= 17;
+ [ThreadStatic]
+ private static object Eightteen= 18;
+ [ThreadStatic]
+ private static object Nineteen= 19;
+ [ThreadStatic]
+ private static object Twenty= 20;
+ [ThreadStatic]
+ private static object TwentyOne= 21;
+ [ThreadStatic]
+ private static object TwentyTwo= 22;
+ [ThreadStatic]
+ private static object TwentyThree= 23;
+ [ThreadStatic]
+ private static object TwentyFour= 24;
+ [ThreadStatic]
+ private static object TwentyFive= 25;
+ [ThreadStatic]
+ private static object TwentySix= 26;
+ [ThreadStatic]
+ private static object TwentySeven= 27;
+ [ThreadStatic]
+ private static object TwentyEight= 28;
+ [ThreadStatic]
+ private static object TwentyNine= 29;
+ [ThreadStatic]
+ private static object Thirty= 30;
+ [ThreadStatic]
+ private static object ThirtyOne= 31;
+ [ThreadStatic]
+ private static object ThirtyTwo= 32;
+
+ public bool CheckValues()
+ {
+ if((int)ThirtyTwo != 32)
+ {
+ Console.WriteLine("Value2 - ThirtySecond spot was incorrect!!!");
+ return false;
+ }
+
+ int value = 0;
+ value = (int)One
+ + (int)Two
+ + (int)Three
+ + (int)Four
+ + (int)Five
+ + (int)Six
+ + (int)Seven
+ + (int)Eight
+ + (int)Nine
+ + (int)Ten
+ + (int)Eleven
+ + (int)Twelve
+ + (int)Thirteen
+ + (int)Fourteen
+ + (int)Fifteen
+ + (int)Sixteen
+ + (int)Seventeen
+ + (int)Eightteen
+ + (int)Nineteen
+ + (int)Twenty
+ + (int)TwentyOne
+ + (int)TwentyTwo
+ + (int)TwentyThree
+ + (int)TwentyFour
+ + (int)TwentyFive
+ + (int)TwentySix
+ + (int)TwentySeven
+ + (int)TwentyEight
+ + (int)TwentyNine
+ + (int)Thirty
+ + (int)ThirtyOne
+ + (int)ThirtyTwo;
+
+ if(value != 528)
+ {
+ Console.WriteLine("Wrong values in ThreadStatics!!! {0}",value);
+ return false;
+ }
+ return true;
+ }
+}
+
+public class Value5
+{
+
+ [ThreadStatic]
+ private static object One= 1;
+ [ThreadStatic]
+ private static object Two= 2;
+ [ThreadStatic]
+ private static object Three= 3;
+ [ThreadStatic]
+ private static object Four= 4;
+ [ThreadStatic]
+ private static object Five= 5;
+ [ThreadStatic]
+ private static object Six= 6;
+ [ThreadStatic]
+ private static object Seven= 7;
+ [ThreadStatic]
+ private static object Eight= 8;
+ [ThreadStatic]
+ private static object Nine= 9;
+ [ThreadStatic]
+ private static object Ten= 10;
+ [ThreadStatic]
+ private static object Eleven= 11;
+ [ThreadStatic]
+ private static object Twelve= 12;
+ [ThreadStatic]
+ private static object Thirteen= 13;
+ [ThreadStatic]
+ private static object Fourteen= 14;
+ [ThreadStatic]
+ private static object Fifteen= 15;
+ [ThreadStatic]
+ private static object Sixteen= 16;
+ [ThreadStatic]
+ private static object Seventeen= 17;
+ [ThreadStatic]
+ private static object Eightteen= 18;
+ [ThreadStatic]
+ private static object Nineteen= 19;
+ [ThreadStatic]
+ private static object Twenty= 20;
+ [ThreadStatic]
+ private static object TwentyOne= 21;
+ [ThreadStatic]
+ private static object TwentyTwo= 22;
+ [ThreadStatic]
+ private static object TwentyThree= 23;
+ [ThreadStatic]
+ private static object TwentyFour= 24;
+ [ThreadStatic]
+ private static object TwentyFive= 25;
+ [ThreadStatic]
+ private static object TwentySix= 26;
+ [ThreadStatic]
+ private static object TwentySeven= 27;
+ [ThreadStatic]
+ private static object TwentyEight= 28;
+ [ThreadStatic]
+ private static object TwentyNine= 29;
+ [ThreadStatic]
+ private static object Thirty= 30;
+ [ThreadStatic]
+ private static object ThirtyOne= 31;
+ [ThreadStatic]
+ private static object ThirtyTwo= 32;
+
+ public bool CheckValues()
+ {
+ if((int)ThirtyTwo != 32)
+ {
+ Console.WriteLine("Value2 - ThirtySecond spot was incorrect!!!");
+ return false;
+ }
+
+ int value = 0;
+ value = (int)One
+ + (int)Two
+ + (int)Three
+ + (int)Four
+ + (int)Five
+ + (int)Six
+ + (int)Seven
+ + (int)Eight
+ + (int)Nine
+ + (int)Ten
+ + (int)Eleven
+ + (int)Twelve
+ + (int)Thirteen
+ + (int)Fourteen
+ + (int)Fifteen
+ + (int)Sixteen
+ + (int)Seventeen
+ + (int)Eightteen
+ + (int)Nineteen
+ + (int)Twenty
+ + (int)TwentyOne
+ + (int)TwentyTwo
+ + (int)TwentyThree
+ + (int)TwentyFour
+ + (int)TwentyFive
+ + (int)TwentySix
+ + (int)TwentySeven
+ + (int)TwentyEight
+ + (int)TwentyNine
+ + (int)Thirty
+ + (int)ThirtyOne
+ + (int)ThirtyTwo;
+
+ if(value != 528)
+ {
+ Console.WriteLine("Wrong values in ThreadStatics!!! {0}",value);
+ return false;
+ }
+ return true;
+ }
+}
+
+public class MyData
+{
+ public AutoResetEvent autoEvent;
+
+ [ThreadStatic]
+ private static Value0 v0;
+ [ThreadStatic]
+ private static Value1 v1;
+ [ThreadStatic]
+ private static Value2 v2;
+
+ [ThreadStatic]
+ private static Value3 v3;
+ [ThreadStatic]
+ private static Value4 v4;
+ [ThreadStatic]
+ private static Value5 v5;
+
+ public bool pass = false;
+
+ public void ThreadTarget()
+ {
+ autoEvent.WaitOne();
+ v0 = new Value0();
+ v1 = new Value1();
+ v2 = new Value2();
+ v3 = new Value3();
+ v4 = new Value4();
+ v5 = new Value5();
+ pass = v0.CheckValues()
+ && v1.CheckValues()
+ && v2.CheckValues()
+ && v3.CheckValues()
+ && v4.CheckValues()
+ && v5.CheckValues();
+ }
+}
+
+public class Test
+{
+
+ private int retVal = 0;
+
+ public static int Main()
+ {
+ Test staticsTest = new Test();
+ staticsTest.RunTest();
+ Console.WriteLine(100 == staticsTest.retVal ? "Test Passed":"Test Failed");
+ return staticsTest.retVal;
+ }
+
+ public void RunTest()
+ {
+ MyData data = new MyData();
+ data.autoEvent = new AutoResetEvent(false);
+
+ Thread t = new Thread(data.ThreadTarget);
+ t.Start();
+ if(!t.IsAlive)
+ {
+ Console.WriteLine("Thread was not set to Alive after starting");
+ retVal = 50;
+ return;
+ }
+ data.autoEvent.Set();
+ t.Join();
+ if(data.pass)
+ retVal = 100;
+ }
+
+}
+
diff --git a/tests/src/baseservices/threading/threadstatic/threadstatic02.cs b/tests/src/baseservices/threading/threadstatic/threadstatic02.cs
new file mode 100644
index 0000000000..acc2dd99ad
--- /dev/null
+++ b/tests/src/baseservices/threading/threadstatic/threadstatic02.cs
@@ -0,0 +1,81 @@
+// 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.
+//ThreadStatics are only initialized on the first thread to call the constructor
+// All other threads will generate a NullRefException when accessing the ref types
+
+using System;
+using System.Threading;
+
+public class MyData
+{
+ public AutoResetEvent autoEvent;
+
+ //This static constructor causes the C# compiler to make this class precise instead of beforefieldinit
+ static MyData()
+ {
+ }
+
+ [ThreadStatic]
+ private static object One = 32;
+
+ public bool pass = false;
+
+ public void ThreadTarget()
+ {
+ pass = CheckValues();
+ }
+
+ private bool CheckValues()
+ {
+ autoEvent.WaitOne();
+ try{
+ Console.WriteLine((int)One);
+ return false;
+ }
+ catch(NullReferenceException)
+ {
+ //Expected exception
+ return true;
+ }
+ }
+
+}
+
+public class Test
+{
+
+ private int retVal = 0;
+
+ public static int Main()
+ {
+ Test staticsTest = new Test();
+ staticsTest.RunTest();
+ Console.WriteLine(100 == staticsTest.retVal ? "Test Passed":"Test Failed");
+ return staticsTest.retVal;
+ }
+
+ public void RunTest()
+ {
+ MyData data = new MyData();
+ data.autoEvent = new AutoResetEvent(false);
+
+ Thread t = new Thread(data.ThreadTarget);
+ t.Start();
+ if(!t.IsAlive)
+ {
+ Console.WriteLine("Thread was not set to Alive after starting");
+ retVal = 50;
+ return;
+ }
+ data.autoEvent.Set();
+ t.Join();
+ if(data.pass)
+ retVal = 100;
+ }
+
+}
+
+
+
+
diff --git a/tests/src/baseservices/threading/threadstatic/threadstatic03.cs b/tests/src/baseservices/threading/threadstatic/threadstatic03.cs
new file mode 100644
index 0000000000..664223b203
--- /dev/null
+++ b/tests/src/baseservices/threading/threadstatic/threadstatic03.cs
@@ -0,0 +1,76 @@
+// 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.
+//ThreadStatics are only initialized on the first thread to call the constructor
+// All other threads get the value 0 set for value types
+
+
+using System;
+using System.Threading;
+
+public class MyData
+{
+ public AutoResetEvent autoEvent;
+
+ [ThreadStatic]
+ private static int Two = 1;
+
+ //This static constructor causes the C# compiler to make this class precise instead of beforefieldinit
+ static MyData()
+ {
+ }
+
+ public bool pass = false;
+
+ public void ThreadTarget()
+ {
+ autoEvent.WaitOne();
+ pass = CheckValues();
+ }
+
+ private bool CheckValues()
+ {
+ if(Two != 0)
+ return false;
+ return true;
+ }
+
+}
+
+public class Test
+{
+
+ private int retVal = 0;
+
+ public static int Main()
+ {
+ Test staticsTest = new Test();
+ staticsTest.RunTest();
+ Console.WriteLine(100 == staticsTest.retVal ? "Test Passed":"Test Failed");
+ return staticsTest.retVal;
+ }
+
+ public void RunTest()
+ {
+ MyData data = new MyData();
+ data.autoEvent = new AutoResetEvent(false);
+
+ Thread t = new Thread(data.ThreadTarget);
+ t.Start();
+ if(!t.IsAlive)
+ {
+ Console.WriteLine("Thread was not set to Alive after starting");
+ retVal = 50;
+ return;
+ }
+ data.autoEvent.Set();
+ t.Join();
+ if(data.pass)
+ retVal = 100;
+ }
+
+}
+
+
+
+
diff --git a/tests/src/baseservices/threading/threadstatic/threadstatic04helper.cs b/tests/src/baseservices/threading/threadstatic/threadstatic04helper.cs
new file mode 100644
index 0000000000..d0f3aa47eb
--- /dev/null
+++ b/tests/src/baseservices/threading/threadstatic/threadstatic04helper.cs
@@ -0,0 +1,29 @@
+// 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;
+
+public class LIA
+{
+ public LIA(byte[] zaoption, object[] zacnttb, string[] zaprgnm, string zaclsnm, Type zatype)
+ {
+ }
+}
+
+public sealed class ILI
+{
+#pragma warning disable 414
+ [ThreadStaticAttribute()]
+ static RCB rcbsave;
+#pragma warning restore 414
+ public ILI(int zapgnum, LIA zalia)
+ {
+ rcbsave = null;
+ }
+}
+
+internal
+class RCB
+{
+}
+
diff --git a/tests/src/baseservices/threading/threadstatic/threadstatic05.cs b/tests/src/baseservices/threading/threadstatic/threadstatic05.cs
new file mode 100644
index 0000000000..1bcf1804be
--- /dev/null
+++ b/tests/src/baseservices/threading/threadstatic/threadstatic05.cs
@@ -0,0 +1,86 @@
+// 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.
+//ThreadStatics are only initialized on the first thread to call the constructor
+// All other threads will generate a NullRefException when accessing the ref types
+
+using System;
+using System.Threading;
+
+public class MyData
+{
+ public AutoResetEvent autoEvent;
+
+ [ThreadStatic]
+ private static object One = 32;
+
+ public bool pass = false;
+
+ public void ThreadTarget()
+ {
+ pass = CheckValues();
+ }
+
+ private bool CheckValues()
+ {
+ autoEvent.WaitOne();
+ try{
+ Console.WriteLine((int)One);
+ return false;
+ }
+ catch(NullReferenceException)
+ {
+ //Expected exception
+ return true;
+ }
+ }
+
+}
+
+public class Test
+{
+
+ private int retVal = 0;
+
+ public static int Main()
+ {
+ Test staticsTest = new Test();
+ staticsTest.RunTest();
+ Console.WriteLine(100 == staticsTest.retVal ? "Test Passed":"Test Failed");
+ return staticsTest.retVal;
+ }
+
+ public void RunTest()
+ {
+ MyData data = new MyData();
+
+ data.autoEvent = new AutoResetEvent(true);
+
+ //This method touches the ThreadStatic members forcing static constructors to be run
+ data.ThreadTarget();
+ if (data.pass != false)
+ {
+ Console.WriteLine("Init did not pass");
+ retVal = 25;
+ return;
+ }
+
+ Thread t = new Thread(data.ThreadTarget);
+ t.Start();
+ if(!t.IsAlive)
+ {
+ Console.WriteLine("Thread was not set to Alive after starting");
+ retVal = 50;
+ return;
+ }
+ data.autoEvent.Set();
+ t.Join();
+ if(data.pass)
+ retVal = 100;
+ }
+
+}
+
+
+
+
diff --git a/tests/src/baseservices/threading/threadstatic/threadstatic06.cs b/tests/src/baseservices/threading/threadstatic/threadstatic06.cs
new file mode 100644
index 0000000000..711284a854
--- /dev/null
+++ b/tests/src/baseservices/threading/threadstatic/threadstatic06.cs
@@ -0,0 +1,80 @@
+// 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.
+//ThreadStatics are only initialized on the first thread to call the constructor
+// All other threads get the value 0 set for value types
+
+
+using System;
+using System.Threading;
+
+public class MyData
+{
+ public AutoResetEvent autoEvent;
+
+ [ThreadStatic]
+ private static int Two = 1;
+
+ public bool pass = false;
+
+ public void ThreadTarget()
+ {
+ autoEvent.WaitOne();
+ pass = CheckValues();
+ }
+
+ private bool CheckValues()
+ {
+ if(Two != 0)
+ return false;
+ return true;
+ }
+
+}
+
+public class Test
+{
+
+ private int retVal = 0;
+
+ public static int Main()
+ {
+ Test staticsTest = new Test();
+ staticsTest.RunTest();
+ Console.WriteLine(100 == staticsTest.retVal ? "Test Passed":"Test Failed");
+ return staticsTest.retVal;
+ }
+
+ public void RunTest()
+ {
+ MyData data = new MyData();
+ data.autoEvent = new AutoResetEvent(true);
+
+ //This method touches the ThreadStatic members forcing static constructors to be run
+ data.ThreadTarget();
+ if (data.pass != false)
+ {
+ Console.WriteLine("Init did not pass");
+ retVal = 25;
+ return;
+ }
+
+ Thread t = new Thread(data.ThreadTarget);
+ t.Start();
+ if(!t.IsAlive)
+ {
+ Console.WriteLine("Thread was not set to Alive after starting");
+ retVal = 50;
+ return;
+ }
+ data.autoEvent.Set();
+ t.Join();
+ if(data.pass)
+ retVal = 100;
+ }
+
+}
+
+
+
+
diff --git a/tests/src/baseservices/threading/threadstatic/threadstatic07.cs b/tests/src/baseservices/threading/threadstatic/threadstatic07.cs
new file mode 100644
index 0000000000..600c6f6df4
--- /dev/null
+++ b/tests/src/baseservices/threading/threadstatic/threadstatic07.cs
@@ -0,0 +1,221 @@
+//Test is checking the ReserveSlot function
+// If someone screws up the function we will end up
+// setting values in the wrong slots and the totals will be wrong
+
+using System;
+using System.IO;
+using System.Threading;
+
+// Test Description:
+// Just basic heavy reading and writing from ThreadStatic members in normal threads and threadpools threads as well.
+// Ported from desktop test: BaseServices\Regression\V1\Threads\ThreadStatic\threadstatic1.cs
+
+public class Sensor
+{
+ [ThreadStatic]
+ static int A = 1;
+ [ThreadStatic]
+ static int B = 2;
+ [ThreadStatic]
+ static int C = 3;
+ [ThreadStatic]
+ static int D = 4;
+ [ThreadStatic]
+ static DateTime T = DateTime.Now;
+ [ThreadStatic]
+ static String S = "John Stockton";
+
+ static volatile int AA = -1;
+ static volatile int BB = -2;
+ static volatile int CC = -3;
+ static volatile int DD = -4;
+ static DateTime TT = DateTime.Now;
+ static String SS = "Karl Malone";
+ static volatile int Result = 100;
+
+ [ThreadStatic]
+ static int AAA = 5;
+ [ThreadStatic]
+ static int BBB = 6;
+ [ThreadStatic]
+ static int CCC = 7;
+ [ThreadStatic]
+ static int DDD = 8;
+ [ThreadStatic]
+ static DateTime TTT = DateTime.Now;
+ [ThreadStatic]
+ static String SSS = "Olden Polynice";
+
+ public static int Main(string[] args)
+ {
+ Console.WriteLine("Hello NBA Fans!!");
+ Console.WriteLine("ThreadStatic test 2: Various reading and writing of Threadstatic variables.");
+ Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}", A, B, C, D, T, S);
+ Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}", AA, BB, CC, DD, TT, SS);
+
+ ValueMess1();
+
+ StartThread();
+ if (Result != 100)
+ {
+ Console.WriteLine("Test Failed.");
+ }
+ else
+ {
+ Console.WriteLine("Test Succeeded.");
+ }
+
+ return Result;
+ }
+
+ public static void StartThread()
+ {
+ Thread SimulationThread;
+ Thread SimulationThread2;
+ Thread SimulationThread3;
+ Thread SimulationThread4;
+ Thread SimulationThread5;
+ Thread SimulationThread6;
+
+ ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadFunc2), null);
+ ValueMess2();
+
+ ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadFunc2), null);
+
+ ValueMess2();
+ SimulationThread = new Thread(new ThreadStart(ThreadFunc));
+ SimulationThread.Start();
+
+ ValueMess2();
+ SimulationThread2 = new Thread(new ThreadStart(ThreadFunc));
+ SimulationThread2.Start();
+
+ ValueMess2();
+ SimulationThread3 = new Thread(new ThreadStart(ThreadFunc));
+ SimulationThread3.Start();
+
+ ValueMess2();
+ SimulationThread4 = new Thread(new ThreadStart(ThreadFunc));
+ SimulationThread4.Start();
+
+ ValueMess2();
+ SimulationThread5 = new Thread(new ThreadStart(ThreadFunc));
+ SimulationThread5.Start();
+
+ ValueMess2();
+ SimulationThread6 = new Thread(new ThreadStart(ThreadFunc));
+ SimulationThread6.Start();
+ Thread.Sleep(500);
+ SimulationThread6.Join();
+
+ ValueMess1();
+ Console.WriteLine("Main A: {0}, {1}, {2}, {3}, {4}, {5}", A, B, C, D, T, S);
+ Console.WriteLine("Main AA: {0}, {1}, {2}, {3}, {4}, {5}", AA, BB, CC, DD, TT, SS);
+ Console.WriteLine("Main AAA: {0}, {1}, {2}, {3}, {4}, {5}", AAA, BBB, CCC, DDD, TTT, SSS);
+ int Y = Thread.CurrentThread.GetHashCode();
+ int X = (A ^ Y) | (B ^ Y) | (C ^ Y) |(D ^ Y)| (AAA ^ Y) | (BBB ^ Y) | (CCC ^ Y) |(DDD ^ Y);
+ Console.WriteLine("X: {0}, {1}", X, S);
+
+ if (X != 0)
+ {
+ Console.WriteLine("Something went wrong in thread: {0}", S);
+ Result = 700 + Y;
+ }
+ }
+
+ public static void ThreadFunc()
+ {
+ Console.WriteLine("ThreadStarted.. {0}", Thread.CurrentThread.GetHashCode().ToString());
+ Console.WriteLine("A: {0}, {1}, {2}, {3}, {4}, {5}", A, B, C, D, T, S);
+ Console.WriteLine("AA: {0}, {1}, {2}, {3}, {4}, {5}", AA, BB, CC, DD, TT, SS);
+ Console.WriteLine("AAA: {0}, {1}, {2}, {3}, {4}, {5}", AAA, BBB, CCC, DDD, TTT, SSS);
+
+ ValueMess1();
+
+ Console.WriteLine("A: {0}, {1}, {2}, {3}, {4}, {5}", A, B, C, D, T, S);
+ Console.WriteLine("AA: {0}, {1}, {2}, {3}, {4}, {5}", AA, BB, CC, DD, TT, SS);
+ Console.WriteLine("AAA: {0}, {1}, {2}, {3}, {4}, {5}", AAA, BBB, CCC, DDD, TTT, SSS);
+
+ int Y = Thread.CurrentThread.GetHashCode();
+ int X = (A ^ Y) | (B ^ Y) | (C ^ Y) |(D ^ Y)| (AAA ^ Y) | (BBB ^ Y) | (CCC ^ Y) |(DDD ^ Y);
+ Console.WriteLine("X: {0}, {1}", X, S);
+
+ if (X != 0)
+ {
+ Console.WriteLine("Something went wrong in thread: {0}", S);
+ Result = 700 + Y;
+ }
+ }
+
+ public static void ThreadFunc2(Object O)
+ {
+ Console.WriteLine("Threadpool Started.. {0}", Thread.CurrentThread.GetHashCode().ToString());
+ Console.WriteLine("TP A: {0}, {1}, {2}, {3}, {4}, {5}", A, B, C, D, T, S);
+ Console.WriteLine("TP AA: {0}, {1}, {2}, {3}, {4}, {5}", AA, BB, CC, DD, TT, SS);
+ Console.WriteLine("TP AAA: {0}, {1}, {2}, {3}, {4}, {5}", AAA, BBB, CCC, DDD, TTT, SSS);
+
+ ValueMess1();
+
+ Console.WriteLine("TP A: {0}, {1}, {2}, {3}, {4}, {5}", A, B, C, D, T, S);
+ Console.WriteLine("TP AA: {0}, {1}, {2}, {3}, {4}, {5}", AA, BB, CC, DD, TT, SS);
+ Console.WriteLine("TP AAA: {0}, {1}, {2}, {3}, {4}, {5}", AAA, BBB, CCC, DDD, TTT, SSS);
+
+ int Y = Thread.CurrentThread.GetHashCode();
+ int X = (A ^ Y) | (B ^ Y) | (C ^ Y) |(D ^ Y)| (AAA ^ Y) | (BBB ^ Y) | (CCC ^ Y) |(DDD ^ Y);
+ Console.WriteLine("X: {0}, {1}", X, S);
+
+ if (X != 0)
+ {
+ Console.WriteLine("Something went wrong in thread: {0}", S);
+ Result = 700 + Y;
+ }
+ }
+
+ public static void ValueMess1()
+ {
+ A = Thread.CurrentThread.GetHashCode();
+ B = Thread.CurrentThread.GetHashCode();
+ C = Thread.CurrentThread.GetHashCode();
+ D = Thread.CurrentThread.GetHashCode();
+ T = DateTime.Now;
+ S = Thread.CurrentThread.GetHashCode().ToString();
+
+ AA = Thread.CurrentThread.GetHashCode();
+ BB = Thread.CurrentThread.GetHashCode();
+ CC = Thread.CurrentThread.GetHashCode();
+ DD = Thread.CurrentThread.GetHashCode();
+ TT = DateTime.Now;
+ SS = Thread.CurrentThread.GetHashCode().ToString();
+
+ AAA = Thread.CurrentThread.GetHashCode();
+ BBB = Thread.CurrentThread.GetHashCode();
+ CCC = Thread.CurrentThread.GetHashCode();
+ DDD = Thread.CurrentThread.GetHashCode();
+ TTT = DateTime.Now;
+ SSS = Thread.CurrentThread.GetHashCode().ToString();
+ }
+
+ public static void ValueMess2()
+ {
+ A = -Thread.CurrentThread.GetHashCode();
+ B = -Thread.CurrentThread.GetHashCode();
+ C = -Thread.CurrentThread.GetHashCode();
+ D = -Thread.CurrentThread.GetHashCode();
+ T = DateTime.Now;
+ S = Thread.CurrentThread.GetHashCode().ToString();
+
+ AA = -Thread.CurrentThread.GetHashCode();
+ BB = -Thread.CurrentThread.GetHashCode();
+ CC = -Thread.CurrentThread.GetHashCode();
+ DD = -Thread.CurrentThread.GetHashCode();
+ TT = DateTime.Now;
+ SS = Thread.CurrentThread.GetHashCode().ToString();
+
+ AAA = -Thread.CurrentThread.GetHashCode();
+ BBB = -Thread.CurrentThread.GetHashCode();
+ CCC = -Thread.CurrentThread.GetHashCode();
+ DDD = -Thread.CurrentThread.GetHashCode();
+ TTT = DateTime.Now;
+ SSS = Thread.CurrentThread.GetHashCode().ToString();
+ }
+}
diff --git a/tests/src/baseservices/threading/threadstatic/threadstatic07.csproj b/tests/src/baseservices/threading/threadstatic/threadstatic07.csproj
new file mode 100644
index 0000000000..0def511c54
--- /dev/null
+++ b/tests/src/baseservices/threading/threadstatic/threadstatic07.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="threadstatic07.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/misc/waithandledispose2.cs b/tests/src/baseservices/threading/waithandle/misc/waithandledispose2.cs
new file mode 100644
index 0000000000..c6dda93a8b
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/misc/waithandledispose2.cs
@@ -0,0 +1,100 @@
+// 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.Threading;
+
+/// <summary>
+/// System.IDisposable.Dispose
+/// </summary>
+
+// Tests disposing of a WaitHandle-derived type
+// via the IDisposable interface.
+// This test is ok for Desktop, but
+// SL does not support Mutex
+public class WaitHandleDispose2
+{
+ #region Public Constants
+ public const int c_DEFAULT_WAIT_TIME = 1000; // 1 second
+ #endregion
+
+#region Public Methods
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+
+ return retVal;
+ }
+
+ #region Positive Test Cases
+ public bool PosTest1()
+ {
+ bool retVal = false;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: Call Dispose");
+
+ try
+ {
+ // Mutex derives from WaitHandle,
+ // and normally you don't create a WaitHandle
+ WaitHandle handle = new Mutex();
+
+ // used to do a cast to IDisposable, but
+ // now WaitHandle implements the IDisposable
+ // interface directly
+ IDisposable disposable = handle as IDisposable;
+ disposable.Dispose();
+
+ // Dispose
+ //handle.Dispose();
+
+ // Do a waitone on the handle, should immediately throw
+ // ObjectDisposedException
+ handle.WaitOne(c_DEFAULT_WAIT_TIME);
+
+ // if we get here, it wasn't disposed of, error
+ TestLibrary.TestFramework.LogError("001", "handle.Dispose() did not dispose of the handle");
+ retVal = false;
+ }
+ catch (ObjectDisposedException)
+ {
+ // swallow it, this is where we wanted to go
+ retVal = true;
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+ #endregion
+ #endregion
+
+ [System.Security.SecurityCritical]
+ public static int Main()
+ {
+ WaitHandleDispose2 test = new WaitHandleDispose2();
+
+ TestLibrary.TestFramework.BeginTestCase("WaitHandleDispose2");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/misc/waithandledispose2.csproj b/tests/src/baseservices/threading/waithandle/misc/waithandledispose2.csproj
new file mode 100644
index 0000000000..36889b9d96
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/misc/waithandledispose2.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitHandleDispose2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/misc/waithandlewaitone1.cs b/tests/src/baseservices/threading/waithandle/misc/waithandlewaitone1.cs
new file mode 100644
index 0000000000..c8815fff85
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/misc/waithandlewaitone1.cs
@@ -0,0 +1,292 @@
+// 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.Threading;
+
+/// <summary>
+/// WaitOne
+/// </summary>
+
+// Verifies that WaitOne can acquire a
+// mutex, that calling it while the mutex is held will
+// cause a thread to block, that if the mutex is
+// never released then WaitOne throws an
+// AbandonedMutexException, and that calling it on a
+// disposed-of mutex throws ObjectDisposedException
+// this test works for Orcas and Client, but Mutex
+// is not supported for Silverlight.
+public class WaitHandleWaitOne1
+{
+ #region Private Fields
+ private const int c_DEFAULT_SLEEP_TIME = 5000; // 1 second
+
+ private WaitHandle m_Handle = null;
+ #endregion
+
+ #region Public Methods
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+
+ TestLibrary.TestFramework.LogInformation("[Negative]");
+ retVal = NegTest1() && retVal;
+ retVal = NegTest2() && retVal;
+
+ return retVal;
+ }
+
+ #region Positive Test Cases
+ // this one tests that a WaitOne will wait on a Mutex
+ // and then grab it when it is free
+ public bool PosTest1()
+ {
+ bool retVal = false;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("PosTest1: WaitOne returns true when current instance receives a signal");
+
+ // m_Handle is of type WaitHandle
+ // Mutex is a subclass of WaitHandle
+ using(m_Handle = new Mutex())
+ {
+ try
+ {
+ // Spin up a thread. SignalMutex grabs
+ // the Mutex, then goes to sleep for 5 seconds. It
+ // only releases the mutex after sleeping for those
+ // 5 seconds
+ thread = new Thread(new ThreadStart(SignalMutex));
+ // Start it
+ thread.Start();
+ // Then put this calling thread to sleep
+ // for one second so that it doesn't beat the spawned
+ // thread to the mutex
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME / 5); // To avoid race
+ // Now, the spawned thread should already
+ // have the mutex and be sleeping on it for several
+ // seconds. try to grab the mutex now. We should
+ // simply block until the other thread releases it,
+ // then we should get it.
+ // Net result, we should get true back from WaitOne
+ if (m_Handle.WaitOne() != true)
+ {
+ TestLibrary.TestFramework.LogError("001", "WaitOne returns false when current instance receives a signal.");
+ retVal = false;
+
+ }
+ else
+ {
+ // got the mutex ok
+ retVal = true;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ // Wait for the thread to terminate
+ if (null != thread)
+ {
+ // Wait on that thread
+ thread.Join();
+ }
+ }
+ }
+
+ return retVal;
+ }
+ #endregion
+
+ #region Negative Test Cases
+ // this one just tests that a WaitOne will receive
+ // a AbandonedMutexException
+ public bool NegTest1()
+ {
+ bool retVal = false;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("NegTest1: AbandonedMutexException should be thrown if a thread exited without releasing a mutex");
+
+ // m_Handle is of type WaitHandle
+ // Mutex is a subclass of WaitHandle
+ using(m_Handle = new Mutex())
+ {
+ try
+ {
+ // Spin up a thread. SignalMutex grabs
+ // the Mutex, then goes to sleep for 5 seconds.
+ thread = new Thread(new ThreadStart(NeverReleaseMutex));
+ // Start it
+ thread.Start();
+ // Then put this calling thread to sleep
+ // for just over one second so that it doesn't beat
+ // the spawned thread to the mutex
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME / 3); // To avoid race
+ // Now, the spawned thread should already
+ // have the mutex and be sleeping on it forever.
+ // try to grab the mutex now. We should simply block until
+ // the other thread releases it, which is never. When that
+ // thread returns from its method, an AbandonedMutexException
+ // should be thrown instead
+ m_Handle.WaitOne();
+
+ // We should not get here
+ TestLibrary.TestFramework.LogError("101", "AbandonedMutexException is not thrown if a thread exited without releasing a mutex");
+ retVal = false;
+ }
+ catch (AbandonedMutexException)
+ {
+ // Swallow it, this is where we want
+ // the test to go
+ retVal = true;
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("102", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ if (null != thread)
+ {
+ // The spawned thread is still running.
+ // Join on it until it is done
+ thread.Join();
+ }
+ }
+ }
+
+ return retVal;
+ }
+
+ // this one just tests that WaitOne will receive an
+ // ObjectDisposedException if the Mutex is disposed of
+ // by the spawned thread while WaitOne is waiting on it
+ public bool NegTest2()
+ {
+ bool retVal = false;
+ Thread thread = null;
+
+ TestLibrary.TestFramework.BeginScenario("NegTest2: ObjectDisposedException should be thrown if current instance has already been disposed");
+
+ try
+ {
+ // m_Handle is of type WaitHandle
+ // Mutex is a subclass of WaitHandle
+ m_Handle = new Mutex();
+
+ // Spin up a thread. DisposeMutex
+ // simply tries to dispose of the mutex.
+ thread = new Thread(new ThreadStart(DisposeMutex));
+ // Start it
+ thread.Start();
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME / 5); // To avoid race
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME);
+ // Now, the spawned thread should have
+ // had plenty of time to dispose of the mutex
+ // Calling WaitOne at this point should result
+ // in an ObjectDisposedException being thrown
+ m_Handle.WaitOne();
+
+ // We should not get here
+ TestLibrary.TestFramework.LogError("103", "ObjectDisposedException is not thrown if current instance has already been disposed");
+ retVal = false;
+ }
+ catch (ObjectDisposedException)
+ {
+ // Swallow it, this is where we want
+ // the test to go
+ retVal = true;
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("104", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+ finally
+ {
+ if (null != thread)
+ {
+ // Wait for the spawned thread to finish
+ // cleaning up
+ thread.Join();
+ }
+
+ if (null != m_Handle)
+ {
+ // spawned thread was unable to dispose of it
+ ((IDisposable)m_Handle).Dispose();
+ }
+ }
+
+ return retVal;
+ }
+ #endregion
+ #endregion
+
+ public static int Main()
+ {
+ WaitHandleWaitOne1 test = new WaitHandleWaitOne1();
+
+ TestLibrary.TestFramework.BeginTestCase("WaitHandleWaitOne1");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ #region Private Methods
+ private void SignalMutex()
+ {
+ // Request ownership of the mutex.
+ // You can use the WaitHandle.WaitOne
+ // method to request ownership of a mutex. Block
+ // until m_Handle receives a signal
+ m_Handle.WaitOne();
+ // Put this thread to sleep
+ // for 5 seconds
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME);
+ // Then release the mutex
+ (m_Handle as Mutex).ReleaseMutex();
+ }
+
+ private void NeverReleaseMutex()
+ {
+ // Request ownership of the mutex.
+ // You can use the WaitHandle.WaitOne
+ // method to request ownership of a mutex. Block
+ // until m_Handle receives a signal
+ m_Handle.WaitOne();
+ // Put this thread to sleep
+ // for 5 seconds
+ Thread.Sleep(c_DEFAULT_SLEEP_TIME);
+ // And we never release
+ // the mutex
+ }
+
+ private void DisposeMutex()
+ {
+ ((IDisposable)m_Handle).Dispose();
+ }
+ #endregion
+}
diff --git a/tests/src/baseservices/threading/waithandle/misc/waithandlewaitone1.csproj b/tests/src/baseservices/threading/waithandle/misc/waithandlewaitone1.csproj
new file mode 100644
index 0000000000..6f4decbee7
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/misc/waithandlewaitone1.csproj
@@ -0,0 +1,44 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitHandleWaitOne1.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+ <Name>coreclr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/emptyarray.cs b/tests/src/baseservices/threading/waithandle/waitall/emptyarray.cs
new file mode 100644
index 0000000000..47f6bdfa85
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/emptyarray.cs
@@ -0,0 +1,41 @@
+// 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.Threading;
+//Regression for DevDiv Bugs 1142
+class Duplicates
+{
+ static int Main()
+ {
+ int retCode = 99;
+
+ WaitHandle[] waitHandles = {};
+
+ // Can't catch exception in v2.0. Should be fixed in Post-Orcas. VSWhidbey 543816
+ try
+ {
+ Console.WriteLine("Before WaitAll");
+ WaitHandle.WaitAll(waitHandles, 5000);
+ Console.WriteLine("After WaitAll");
+ }
+ catch (ArgumentException)
+ {
+ retCode = 100;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("WaitAll threw unexpected Exception.");
+ Console.WriteLine("WaitAll: {0}", ex);
+ retCode = 98;
+ }
+
+ if (retCode ==100)
+ Console.WriteLine("Test Passed");
+ else
+ Console.WriteLine("Test Failed");
+
+ return retCode;
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/nullarray.cs b/tests/src/baseservices/threading/waithandle/waitall/nullarray.cs
new file mode 100644
index 0000000000..cdc17e4a23
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/nullarray.cs
@@ -0,0 +1,52 @@
+// 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.Threading;
+//Regression for DevDiv Bugs 1142
+class Duplicates
+{
+ static int Main()
+ {
+ int retCode = 99;
+
+ // Console.WriteLine(Thread.CurrentThread.GetApartmentState());
+
+ // Not supported (CoreCLR GitHub issue #2999)
+ // AppDomain.CurrentDomain.UnhandledException += Unhandled;
+
+ WaitHandle[] waitHandles = null;
+
+ // Can't catch exception in v2.0. Should be fixed in Post-Orcas. VSWhidbey 543816
+ try
+ {
+ Console.WriteLine("Before WaitAll");
+ WaitHandle.WaitAll(waitHandles, 5000);//, false);
+ Console.WriteLine("After WaitAll");
+ }
+ catch (ArgumentNullException)
+ {
+ retCode = 100;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("WaitAll threw unexpected Exception.");
+ Console.WriteLine("WaitAll: {0}", ex);
+ retCode = 98;
+ }
+
+ if (retCode ==100)
+ Console.WriteLine("Test Passed");
+ else
+ Console.WriteLine("Test Failed");
+
+ return retCode;
+ }
+
+ // private static void Unhandled(object sender, UnhandledExceptionEventArgs args)
+ // {
+ // Exception e = (Exception) args.ExceptionObject;
+ // Console.WriteLine("Unhandled reports: {0}", e);
+ // }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/nullarraymember.cs b/tests/src/baseservices/threading/waithandle/waitall/nullarraymember.cs
new file mode 100644
index 0000000000..61b1e9e9f2
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/nullarraymember.cs
@@ -0,0 +1,41 @@
+// 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.Threading;
+
+class Duplicates
+{
+ static int Main()
+ {
+ int retCode = 99;
+
+ WaitHandle[] waitHandles = { new Mutex(), new Mutex(), null, new Mutex() };
+
+ // Can't catch exception in v2.0. Should be fixed in Post-Orcas. VSWhidbey 543816
+ try
+ {
+ Console.WriteLine("Before WaitAll");
+ WaitHandle.WaitAll(waitHandles, 5000);
+ Console.WriteLine("After WaitAll");
+ }
+ catch (ArgumentNullException)
+ {
+ retCode = 100;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("WaitAll threw unexpected Exception.");
+ Console.WriteLine("WaitAll: {0}", ex);
+ retCode = 98;
+ }
+
+ if (retCode ==100)
+ Console.WriteLine("Test Passed");
+ else
+ Console.WriteLine("Test Failed");
+
+ return retCode;
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/nullarraymember.csproj b/tests/src/baseservices/threading/waithandle/waitall/nullarraymember.csproj
new file mode 100644
index 0000000000..7951b95454
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/nullarraymember.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="NullArrayMember.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallemptyarray.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallemptyarray.csproj
new file mode 100644
index 0000000000..e06d074968
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallemptyarray.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EmptyArray.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex1.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex1.cs
new file mode 100644
index 0000000000..2adb4efefe
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex1.cs
@@ -0,0 +1,60 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMutex = new Mutex(false, Common.GetUniqueName());
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Testing Mutex and non-Mutex, " +
+ "not signaling the other element");
+ Thread t = new Thread(new ThreadStart(this.AbandonTheMutex));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(
+ new WaitHandle[]{myMutex,
+ new ManualResetEvent(false)}, 5000);
+ // Expected timeout and NOT throw exception
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonTheMutex()
+ {
+ Console.WriteLine("Acquire the Mutex");
+ myMutex.WaitOne();
+ Console.WriteLine("Holding the Mutex");
+ // Not calling ReleaseMutex() so the Mutex becomes abandoned
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex1.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex1.csproj
new file mode 100644
index 0000000000..8fb833fab2
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex1.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx1.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex10.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex10.cs
new file mode 100644
index 0000000000..32a61f4fe0
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex10.cs
@@ -0,0 +1,103 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ WaitHandle[] wh;
+ ManualResetEvent myMRE;
+
+ public WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: WaitAllEx10 /size:<int> /pos:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iPos=-1, iSize = -1;;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/size:"))
+ {
+ iSize = Convert.ToInt32(args[i].Substring(6));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/pos:"))
+ {
+ iPos = Convert.ToInt32(args[i].Substring(5));
+ }
+ }
+
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run(iSize, iPos);
+ }
+
+ private int Run(int iNumElements, int iPos)
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon during a wait, signaling others - " +
+ iNumElements + ", " + iPos);
+ CreateOneMutexArray(iNumElements, iPos);
+
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexesWait));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(wh, 10000);
+ Console.WriteLine("AbandonedMutexException was not thrown!");
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexesWait()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ else
+ ((ManualResetEvent)w).Set();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateOneMutexArray(int numElements, int iPos)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ if(i == iPos)
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ else
+ wh[i] = new ManualResetEvent(false);
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex10.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex10.csproj
new file mode 100644
index 0000000000..15f7b44065
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex10.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/size:64 /pos:63</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx10.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex10a.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex10a.cs
new file mode 100644
index 0000000000..98f98261a4
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex10a.cs
@@ -0,0 +1,103 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ WaitHandle[] wh;
+ ManualResetEvent myMRE;
+
+ public WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: WaitAllEx10 /size:<int> /pos:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iPos=-1, iSize = -1;;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/size:"))
+ {
+ iSize = Convert.ToInt32(args[i].Substring(6));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/pos:"))
+ {
+ iPos = Convert.ToInt32(args[i].Substring(5));
+ }
+ }
+
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run(iSize, iPos);
+ }
+
+ private int Run(int iNumElements, int iPos)
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon during a wait, signaling others - " +
+ iNumElements + ", " + iPos);
+ CreateOneMutexArray(iNumElements, iPos);
+
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexesWait));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(wh);
+ Console.WriteLine("AbandonedMutexException was not thrown!");
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexesWait()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ else
+ ((ManualResetEvent)w).Set();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateOneMutexArray(int numElements, int iPos)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ if(i == iPos)
+ wh[i] = new Mutex();
+ else
+ wh[i] = new ManualResetEvent(false);
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex10a.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex10a.csproj
new file mode 100644
index 0000000000..c1887d3ed8
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex10a.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/size:64 /pos:0</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx10a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex11.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex11.cs
new file mode 100644
index 0000000000..cb2f8d72ca
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex11.cs
@@ -0,0 +1,70 @@
+// 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.Threading;
+
+// This is a non-9x test
+
+class WaitAllEx
+{
+ private WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon before a wait");
+ CreateMutexArray(64);
+
+ Thread t = new Thread(new ThreadStart(this.AbandonMutexWait));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(wh, 10000);
+ Console.WriteLine("WaitAll did not throw an " +
+ "exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutexWait()
+ {
+ wh[63].WaitOne();
+ myMRE.Set();
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex11.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex11.csproj
new file mode 100644
index 0000000000..d738e32130
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex11.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx11.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex11a.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex11a.cs
new file mode 100644
index 0000000000..d98e0265d0
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex11a.cs
@@ -0,0 +1,70 @@
+// 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.Threading;
+
+// This is a non-9x test
+
+class WaitAllEx
+{
+ private WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon before a wait");
+ CreateMutexArray(64);
+
+ Thread t = new Thread(new ThreadStart(this.AbandonMutexWait));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(wh);
+ Console.WriteLine("WaitAll did not throw an " +
+ "exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutexWait()
+ {
+ wh[63].WaitOne();
+ myMRE.Set();
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex();
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex11a.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex11a.csproj
new file mode 100644
index 0000000000..65281cd3c3
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex11a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx11a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex1a.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex1a.cs
new file mode 100644
index 0000000000..3c63d0bb51
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex1a.cs
@@ -0,0 +1,60 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMutex = new Mutex();
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Testing Mutex and non-Mutex, " +
+ "not signaling the other element");
+ Thread t = new Thread(new ThreadStart(this.AbandonTheMutex));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(
+ new WaitHandle[]{myMutex,
+ new ManualResetEvent(false)}, 5000);
+ // Expected timeout and NOT throw exception
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonTheMutex()
+ {
+ Console.WriteLine("Acquire the Mutex");
+ myMutex.WaitOne();
+ Console.WriteLine("Holding the Mutex");
+ // Not calling ReleaseMutex() so the Mutex becomes abandoned
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex1a.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex1a.csproj
new file mode 100644
index 0000000000..22814dd233
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex1a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx1a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex2.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex2.cs
new file mode 100644
index 0000000000..0970739515
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex2.cs
@@ -0,0 +1,66 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMutex = new Mutex(false, Common.GetUniqueName());
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Testing Mutex and non-Mutex, " +
+ "and signaling the other element");
+ Thread t = new Thread(new ThreadStart(this.AbandonAndSet));
+ t.Start();
+ myMRE.WaitOne();
+ bool bRet = false;
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bRet = WaitHandle.WaitAll(
+ new WaitHandle[]{myMutex, myMRE}, 5000);
+ Console.WriteLine("WaitAll did not throw an " +
+ "exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAndSet()
+ {
+ Console.WriteLine("Acquire the Mutex");
+ myMutex.WaitOne();
+ Console.WriteLine("Holding the Mutex");
+ // Signaling the Event
+ myMRE.Set();
+ // Not calling ReleaseMutex() so the Mutex becomes abandoned
+ Thread.Sleep(1000);
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex2.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex2.csproj
new file mode 100644
index 0000000000..410223566d
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex2.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx2.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex2a.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex2a.cs
new file mode 100644
index 0000000000..fdddeb7811
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex2a.cs
@@ -0,0 +1,66 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMutex = new Mutex();
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Testing Mutex and non-Mutex, " +
+ "and signaling the other element");
+ Thread t = new Thread(new ThreadStart(this.AbandonAndSet));
+ t.Start();
+ myMRE.WaitOne();
+ bool bRet = false;
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bRet = WaitHandle.WaitAll(
+ new WaitHandle[]{myMutex, myMRE});
+ Console.WriteLine("WaitAll did not throw an " +
+ "exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAndSet()
+ {
+ Console.WriteLine("Acquire the Mutex");
+ myMutex.WaitOne();
+ Console.WriteLine("Holding the Mutex");
+ // Signaling the Event
+ myMRE.Set();
+ // Not calling ReleaseMutex() so the Mutex becomes abandoned
+ Thread.Sleep(1000);
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex2a.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex2a.csproj
new file mode 100644
index 0000000000..0d8cace3ac
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex2a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx2a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex3.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex3.cs
new file mode 100644
index 0000000000..da2678f7e3
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex3.cs
@@ -0,0 +1,97 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandoning more than one mutex mix " +
+ "with other WaitHandles, signaling other elements");
+ CreateArray(64);
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexes));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(wh, 10000);
+ Console.WriteLine("WaitAll did not throw an " +
+ "exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexes()
+ {
+ Mutex m = new Mutex();
+ AutoResetEvent are = new AutoResetEvent(false);
+
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == myMRE.GetType())
+ ((ManualResetEvent)w).Set();
+ if(w.GetType() == are.GetType())
+ ((AutoResetEvent)w).Set();
+ }
+ }
+
+ private void CreateArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ switch(i%4)
+ {
+ case 0:
+ wh[i] = new AutoResetEvent(false);
+ break;
+ case 1:
+ wh[i] = new ManualResetEvent(false);
+ break;
+ case 2:
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ break;
+ case 3:
+ wh[i] = new Semaphore(5,5);
+ break;
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex3.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex3.csproj
new file mode 100644
index 0000000000..629c6f9182
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex3.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx3.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex3a.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex3a.cs
new file mode 100644
index 0000000000..acd4753e6b
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex3a.cs
@@ -0,0 +1,97 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandoning more than one mutex mix " +
+ "with other WaitHandles, signaling other elements");
+ CreateArray(64);
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexes));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(wh);
+ Console.WriteLine("WaitAll did not throw an " +
+ "exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexes()
+ {
+ Mutex m = new Mutex();
+ AutoResetEvent are = new AutoResetEvent(false);
+
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == myMRE.GetType())
+ ((ManualResetEvent)w).Set();
+ if(w.GetType() == are.GetType())
+ ((AutoResetEvent)w).Set();
+ }
+ }
+
+ private void CreateArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ switch(i%4)
+ {
+ case 0:
+ wh[i] = new AutoResetEvent(false);
+ break;
+ case 1:
+ wh[i] = new ManualResetEvent(false);
+ break;
+ case 2:
+ wh[i] = new Mutex();
+ break;
+ case 3:
+ wh[i] = new Semaphore(5,5);
+ break;
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex3a.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex3a.csproj
new file mode 100644
index 0000000000..8e279210fb
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex3a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx3a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex4.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex4.cs
new file mode 100644
index 0000000000..666b1cefa3
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex4.cs
@@ -0,0 +1,87 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandoning only one Mutex " +
+ "in array with other WaitHandles");
+ CreateArray(64);
+ Thread t = new Thread(new ThreadStart(this.AbandonOne));
+ t.Start();
+ myMRE.WaitOne();
+ bool bRet = false;
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bRet = WaitHandle.WaitAll(wh, 5000);
+ // Expected timeout and no exception thrown
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonOne()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ {
+ w.WaitOne();
+ break;
+ }
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ switch(i%4)
+ {
+ case 0:
+ wh[i] = new AutoResetEvent(false);
+ break;
+ case 1:
+ wh[i] = new ManualResetEvent(false);
+ break;
+ case 2:
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ break;
+ case 3:
+ wh[i] = new Semaphore(5,5);
+ break;
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex4.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex4.csproj
new file mode 100644
index 0000000000..d843c88984
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex4.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx4.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex4a.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex4a.cs
new file mode 100644
index 0000000000..5b98e4476e
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex4a.cs
@@ -0,0 +1,87 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandoning only one Mutex " +
+ "in array with other WaitHandles");
+ CreateArray(64);
+ Thread t = new Thread(new ThreadStart(this.AbandonOne));
+ t.Start();
+ myMRE.WaitOne();
+ bool bRet = false;
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bRet = WaitHandle.WaitAll(wh, 5000);
+ // Expected timeout and no exception thrown
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonOne()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ {
+ w.WaitOne();
+ break;
+ }
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ switch(i%4)
+ {
+ case 0:
+ wh[i] = new AutoResetEvent(false);
+ break;
+ case 1:
+ wh[i] = new ManualResetEvent(true);
+ break;
+ case 2:
+ wh[i] = new Mutex();
+ break;
+ case 3:
+ wh[i] = new Semaphore(5,5);
+ break;
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex4a.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex4a.csproj
new file mode 100644
index 0000000000..c1aa02a883
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex4a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx4a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex5.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex5.cs
new file mode 100644
index 0000000000..e3232cc73d
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex5.cs
@@ -0,0 +1,89 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandoning only one Mutex in array " +
+ "with other WaitHandles, signaling other mutexes");
+ CreateArray(64);
+ Thread t = new Thread(new ThreadStart(this.AbandonOneAndRelease));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(wh, 5000);
+ // Expected timeout and no exception thrown
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonOneAndRelease()
+ {
+ Mutex m = new Mutex();
+ bool bSet = false;
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ {
+ w.WaitOne();
+ myMRE.Set();
+ if(bSet)
+ ((Mutex)w).ReleaseMutex();
+ bSet = true;
+ }
+ }
+ Thread.Sleep(1000);
+ }
+
+ private void CreateArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ switch(i%4)
+ {
+ case 0:
+ wh[i] = new AutoResetEvent(false);
+ break;
+ case 1:
+ wh[i] = new ManualResetEvent(false);
+ break;
+ case 2:
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ break;
+ case 3:
+ wh[i] = new Semaphore(5,5);
+ break;
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex5.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex5.csproj
new file mode 100644
index 0000000000..0ba55718d7
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex5.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx5.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex5a.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex5a.cs
new file mode 100644
index 0000000000..a59ebbb2ce
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex5a.cs
@@ -0,0 +1,89 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandoning only one Mutex in array " +
+ "with other WaitHandles, signaling other mutexes");
+ CreateArray(64);
+ Thread t = new Thread(new ThreadStart(this.AbandonOneAndRelease));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(wh, 5000);
+ // Expected timeout and no exception thrown
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonOneAndRelease()
+ {
+ Mutex m = new Mutex();
+ bool bSet = false;
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ {
+ w.WaitOne();
+ myMRE.Set();
+ if(bSet)
+ ((Mutex)w).ReleaseMutex();
+ bSet = true;
+ }
+ }
+ Thread.Sleep(1000);
+ }
+
+ private void CreateArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ switch(i%4)
+ {
+ case 0:
+ wh[i] = new AutoResetEvent(true);
+ break;
+ case 1:
+ wh[i] = new ManualResetEvent(false);
+ break;
+ case 2:
+ wh[i] = new Mutex();
+ break;
+ case 3:
+ wh[i] = new Semaphore(5,5);
+ break;
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex5a.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex5a.csproj
new file mode 100644
index 0000000000..90cb489307
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex5a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx5a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex6.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex6.cs
new file mode 100644
index 0000000000..450e101e16
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex6.cs
@@ -0,0 +1,94 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: WaitAllEx6 /size:<int> /pos:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iPos=-1, iSize = -1;;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/size:"))
+ {
+ iSize = Convert.ToInt32(args[i].Substring(6));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/pos:"))
+ {
+ iPos = Convert.ToInt32(args[i].Substring(5));
+ }
+ }
+
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run(iSize, iPos);
+ }
+
+ private int Run(int iArraySize, int iPosToAbandon)
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon a particular mutex - " + iArraySize + ", " +
+ iPosToAbandon);
+ CreateMutexArray(iArraySize);
+ Thread t = new Thread(new
+ ParameterizedThreadStart(this.AbandonMutexPos));
+ t.Start(iPosToAbandon);
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(wh, 5000);
+ Console.WriteLine("WaitAll did not throw an " +
+ "exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutexPos(Object o)
+ {
+ wh[Convert.ToInt32(o)].WaitOne();
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex6.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex6.csproj
new file mode 100644
index 0000000000..726085c867
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex6.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/size:2 /pos:0</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx6.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex6a.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex6a.cs
new file mode 100644
index 0000000000..a5573ad712
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex6a.cs
@@ -0,0 +1,94 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: WaitAllEx6a /size:<int> /pos:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iPos=-1, iSize = -1;;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/size:"))
+ {
+ iSize = Convert.ToInt32(args[i].Substring(6));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/pos:"))
+ {
+ iPos = Convert.ToInt32(args[i].Substring(5));
+ }
+ }
+
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run(iSize, iPos);
+ }
+
+ private int Run(int iArraySize, int iPosToAbandon)
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon a particular mutex - " + iArraySize + ", " +
+ iPosToAbandon);
+ CreateMutexArray(iArraySize);
+ Thread t = new Thread(new
+ ParameterizedThreadStart(this.AbandonMutexPos));
+ t.Start(iPosToAbandon);
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(wh);
+ Console.WriteLine("WaitAll did not throw an " +
+ "exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutexPos(Object o)
+ {
+ wh[Convert.ToInt32(o)].WaitOne();
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex();
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex6a.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex6a.csproj
new file mode 100644
index 0000000000..63d8625a39
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex6a.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/size:64 /pos:30</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx6a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex7.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex7.cs
new file mode 100644
index 0000000000..8e216d9a3b
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex7.cs
@@ -0,0 +1,76 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon all mutexes in array");
+ CreateMutexArray(64);
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexes));
+ t.Start();
+ myMRE.WaitOne();
+ bool bRet = false;
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bRet = WaitHandle.WaitAll(wh, 5000);
+ Console.WriteLine("WaitAll did not throw an " +
+ "exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexes()
+ {
+ Mutex m = new Mutex();
+ AutoResetEvent are = new AutoResetEvent(false);
+
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex7.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex7.csproj
new file mode 100644
index 0000000000..72f4abc30b
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex7.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx7.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex7a.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex7a.cs
new file mode 100644
index 0000000000..69bcd965d1
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex7a.cs
@@ -0,0 +1,76 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon all mutexes in array");
+ CreateMutexArray(64);
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexes));
+ t.Start();
+ myMRE.WaitOne();
+ bool bRet = false;
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bRet = WaitHandle.WaitAll(wh);
+ Console.WriteLine("WaitAll did not throw an " +
+ "exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexes()
+ {
+ Mutex m = new Mutex();
+ AutoResetEvent are = new AutoResetEvent(false);
+
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex();
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex7a.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex7a.csproj
new file mode 100644
index 0000000000..6da32e2b8b
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex7a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx7a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex8.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex8.cs
new file mode 100644
index 0000000000..2d796e61bf
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex8.cs
@@ -0,0 +1,76 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon same named mutex");
+ // Create array with the same name
+ string sName = Common.GetUniqueName();
+ wh = new Mutex[2];
+ wh[0] = new Mutex(false, sName);
+ wh[1] = new Mutex(false, sName);
+
+ Thread t = new Thread(new
+ ParameterizedThreadStart(this.AbandonMutexPos));
+ t.Start(0);
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(wh, 10000);
+ Console.WriteLine("WaitAll did not throw an " +
+ "exception, bRet = " + bRet);
+ }
+ catch(ArgumentException)
+ {
+ // bug #237497 - ArgumentException is thrown instead of
+ // an AbandonedMutexException.
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutexPos(Object o)
+ {
+ wh[Convert.ToInt32(o)].WaitOne();
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex8.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex8.csproj
new file mode 100644
index 0000000000..31d9ced98a
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex8.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx8.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex8a.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex8a.cs
new file mode 100644
index 0000000000..99b5234d9f
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex8a.cs
@@ -0,0 +1,76 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ private WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ private WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon same named mutex");
+ // Create array with the same name
+ string sName = Common.GetUniqueName();
+ wh = new Mutex[2];
+ wh[0] = new Mutex(false, sName);
+ wh[1] = new Mutex(false, sName);
+
+ Thread t = new Thread(new
+ ParameterizedThreadStart(this.AbandonMutexPos));
+ t.Start(0);
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(wh);
+ Console.WriteLine("WaitAll did not throw an " +
+ "exception, bRet = " + bRet);
+ }
+ catch(ArgumentException)
+ {
+ // bug #237497 - ArgumentException is thrown instead of
+ // an AbandonedMutexException.
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutexPos(Object o)
+ {
+ wh[Convert.ToInt32(o)].WaitOne();
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex();
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex8a.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex8a.csproj
new file mode 100644
index 0000000000..4d9ef802fa
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex8a.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx8a.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex9.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex9.cs
new file mode 100644
index 0000000000..f8ea18511f
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex9.cs
@@ -0,0 +1,100 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ WaitHandle[] wh;
+ ManualResetEvent myMRE;
+
+ public WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: WaitAllEx9 /size:<int> /pos:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iPos=-1, iSize = -1;;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/size:"))
+ {
+ iSize = Convert.ToInt32(args[i].Substring(6));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/pos:"))
+ {
+ iPos = Convert.ToInt32(args[i].Substring(5));
+ }
+ }
+
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run(iSize, iPos);
+ }
+
+ private int Run(int iNumElements, int iPos)
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon during a wait - " + iNumElements + ", " +
+ iPos);
+ CreateOneMutexArray(iNumElements, iPos);
+
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexesWait));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(wh, 5000);
+ // Expected timeout and pass
+ if(bRet)
+ Console.WriteLine("No exception thrown!");
+ else
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexesWait()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateOneMutexArray(int numElements, int iPos)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ if(i == iPos)
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ else
+ wh[i] = new ManualResetEvent(false);
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex9.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex9.csproj
new file mode 100644
index 0000000000..c8526ded8d
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex9.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/size:64 /pos:63</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx9.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex9a.cs b/tests/src/baseservices/threading/waithandle/waitall/waitallex9a.cs
new file mode 100644
index 0000000000..37b2484656
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex9a.cs
@@ -0,0 +1,100 @@
+// 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.Threading;
+
+class WaitAllEx
+{
+ WaitHandle[] wh;
+ ManualResetEvent myMRE;
+
+ public WaitAllEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: WaitAllEx9a /size:<int> /pos:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iPos=-1, iSize = -1;;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/size:"))
+ {
+ iSize = Convert.ToInt32(args[i].Substring(6));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/pos:"))
+ {
+ iPos = Convert.ToInt32(args[i].Substring(5));
+ }
+ }
+
+ WaitAllEx wae = new WaitAllEx();
+ return wae.Run(iSize, iPos);
+ }
+
+ private int Run(int iNumElements, int iPos)
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon during a wait - " + iNumElements + ", " +
+ iPos);
+ CreateOneMutexArray(iNumElements, iPos);
+
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexesWait));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ bool bRet = WaitHandle.WaitAll(wh, 5000);
+ // Expected timeout and pass
+ if(bRet)
+ Console.WriteLine("No exception thrown!");
+ else
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexesWait()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateOneMutexArray(int numElements, int iPos)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ if(i == iPos)
+ wh[i] = new Mutex();
+ else
+ wh[i] = new ManualResetEvent(false);
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallex9a.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallex9a.csproj
new file mode 100644
index 0000000000..9d8bf223e5
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallex9a.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/size:64 /pos:0</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAllEx9a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitall/waitallnullarray.csproj b/tests/src/baseservices/threading/waithandle/waitall/waitallnullarray.csproj
new file mode 100644
index 0000000000..b815d5fb92
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitall/waitallnullarray.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="NullArray.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/emptyarray.cs b/tests/src/baseservices/threading/waithandle/waitany/emptyarray.cs
new file mode 100644
index 0000000000..ef15894d79
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/emptyarray.cs
@@ -0,0 +1,41 @@
+// 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.Threading;
+//Regression for DevDiv Bugs 1142
+class Duplicates
+{
+ static int Main()
+ {
+ int retCode = 99;
+
+ WaitHandle[] waitHandles = {};
+
+ // Can't catch exception in v2.0. Should be fixed in Post-Orcas. VSWhidbey 543816
+ try
+ {
+ Console.WriteLine("Before WaitAny");
+ WaitHandle.WaitAny(waitHandles, 5000);
+ Console.WriteLine("After WaitAny");
+ }
+ catch (ArgumentException)
+ {
+ retCode = 100;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("WaitAny threw unexpected Exception.");
+ Console.WriteLine("WaitAny: {0}", ex);
+ retCode = 98;
+ }
+
+ if (retCode ==100)
+ Console.WriteLine("Test Passed");
+ else
+ Console.WriteLine("Test Failed");
+
+ return retCode;
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/nullarray.cs b/tests/src/baseservices/threading/waithandle/waitany/nullarray.cs
new file mode 100644
index 0000000000..7d4cb18d5a
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/nullarray.cs
@@ -0,0 +1,41 @@
+// 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.Threading;
+//Regression for DevDiv Bugs 1142
+class Duplicates
+{
+ static int Main()
+ {
+ int retCode = 99;
+
+ WaitHandle[] waitHandles = null;
+
+ // Can't catch exception in v2.0. Should be fixed in Post-Orcas. VSWhidbey 543816
+ try
+ {
+ Console.WriteLine("Before WaitAny");
+ WaitHandle.WaitAny(waitHandles, 5000);
+ Console.WriteLine("After WaitAny");
+ }
+ catch (ArgumentNullException)
+ {
+ retCode = 100;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("WaitAny threw unexpected Exception.");
+ Console.WriteLine("WaitAny: {0}", ex);
+ retCode = 98;
+ }
+
+ if (retCode ==100)
+ Console.WriteLine("Test Passed");
+ else
+ Console.WriteLine("Test Failed");
+
+ return retCode;
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/nullarraymember.cs b/tests/src/baseservices/threading/waithandle/waitany/nullarraymember.cs
new file mode 100644
index 0000000000..8b24b45942
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/nullarraymember.cs
@@ -0,0 +1,41 @@
+// 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.Threading;
+
+class Duplicates
+{
+ static int Main()
+ {
+ int retCode = 99;
+
+ WaitHandle[] waitHandles = { new Mutex(), new Mutex(), null, new Mutex() };
+
+ // Can't catch exception in v2.0. Should be fixed in Post-Orcas. VSWhidbey 543816
+ try
+ {
+ Console.WriteLine("Before WaitAny");
+ WaitHandle.WaitAny(waitHandles, 5000);
+ Console.WriteLine("After WaitAny");
+ }
+ catch (ArgumentNullException)
+ {
+ retCode = 100;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("WaitAny threw unexpected Exception.");
+ Console.WriteLine("WaitAny: {0}", ex);
+ retCode = 98;
+ }
+
+ if (retCode ==100)
+ Console.WriteLine("Test Passed");
+ else
+ Console.WriteLine("Test Failed");
+
+ return retCode;
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/nullarraymemberwaitany.csproj b/tests/src/baseservices/threading/waithandle/waitany/nullarraymemberwaitany.csproj
new file mode 100644
index 0000000000..7951b95454
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/nullarraymemberwaitany.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="NullArrayMember.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyemptyarray.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyemptyarray.csproj
new file mode 100644
index 0000000000..e06d074968
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyemptyarray.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="EmptyArray.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex1.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex1.cs
new file mode 100644
index 0000000000..b55f8a0fde
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex1.cs
@@ -0,0 +1,65 @@
+// 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.Threading;
+
+class WaitAnyEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+
+ public WaitAnyEx()
+ {
+ myMutex = new Mutex(false, Common.GetUniqueName());
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Testing Mutex and non-Mutex, " +
+ "not signaling the other element");
+ Thread t = new Thread(new ThreadStart(this.AbandonTheMutex));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(
+ new WaitHandle[]{myMutex,
+ new ManualResetEvent(false)}, 10000);
+ Console.WriteLine("WaitAny did not throw an " +
+ "exception, i = " + i);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonTheMutex()
+ {
+ Console.WriteLine("Acquire the Mutex");
+ myMutex.WaitOne();
+ Console.WriteLine("Holding the Mutex");
+ // Not calling ReleaseMutex() so the Mutex becomes abandoned
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex1.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex1.csproj
new file mode 100644
index 0000000000..4176b3abfc
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex1.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx1.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex10.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex10.cs
new file mode 100644
index 0000000000..bb13264d4c
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex10.cs
@@ -0,0 +1,104 @@
+// 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.Threading;
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+ ManualResetEvent myMRE;
+
+ public WaitAnyEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: WaitAnyEx10 /size:<int> /pos:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iPos=-1, iSize = -1;;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/size:"))
+ {
+ iSize = Convert.ToInt32(args[i].Substring(6));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/pos:"))
+ {
+ iPos = Convert.ToInt32(args[i].Substring(5));
+ }
+ }
+
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run(iSize, iPos);
+ }
+
+ private int Run(int iNumElements, int iPos)
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon during a wait, signaling others - " +
+ iNumElements + ", " + iPos);
+ CreateOneMutexArray(iNumElements, iPos);
+
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexesWait));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(wh, 10000);
+ iRet = 100;
+ }
+ catch(AbandonedMutexException)
+ {
+ // Should never throw
+ Console.WriteLine("AbandonedMutexException thrown and " +
+ "shouldn't have");
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexesWait()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ else
+ ((ManualResetEvent)w).Set();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateOneMutexArray(int numElements, int iPos)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ if(i == iPos)
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ else
+ wh[i] = new ManualResetEvent(false);
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex10.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex10.csproj
new file mode 100644
index 0000000000..c9988d572a
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex10.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/size:2 /pos:1</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx10.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex10a.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex10a.cs
new file mode 100644
index 0000000000..b92f81985e
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex10a.cs
@@ -0,0 +1,104 @@
+// 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.Threading;
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+ ManualResetEvent myMRE;
+
+ public WaitAnyEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: WaitAnyEx10a /size:<int> /pos:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iPos=-1, iSize = -1;;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/size:"))
+ {
+ iSize = Convert.ToInt32(args[i].Substring(6));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/pos:"))
+ {
+ iPos = Convert.ToInt32(args[i].Substring(5));
+ }
+ }
+
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run(iSize, iPos);
+ }
+
+ private int Run(int iNumElements, int iPos)
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon during a wait, signaling others - " +
+ iNumElements + ", " + iPos);
+ CreateOneMutexArray(iNumElements, iPos);
+
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexesWait));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(wh);
+ iRet = 100;
+ }
+ catch(AbandonedMutexException)
+ {
+ // Should never throw
+ Console.WriteLine("AbandonedMutexException thrown and " +
+ "shouldn't have");
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexesWait()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ else
+ ((ManualResetEvent)w).Set();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateOneMutexArray(int numElements, int iPos)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ if(i == iPos)
+ wh[i] = new Mutex();
+ else
+ wh[i] = new ManualResetEvent(false);
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex10a.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex10a.csproj
new file mode 100644
index 0000000000..f930f87de2
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex10a.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/size:2 /pos:1</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx10a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex1a.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex1a.cs
new file mode 100644
index 0000000000..4638d32d72
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex1a.cs
@@ -0,0 +1,65 @@
+// 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.Threading;
+
+class WaitAnyEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+
+ public WaitAnyEx()
+ {
+ myMutex = new Mutex();
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Testing Mutex and non-Mutex, " +
+ "not signaling the other element");
+ Thread t = new Thread(new ThreadStart(this.AbandonTheMutex));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(
+ new WaitHandle[]{myMutex,
+ new ManualResetEvent(false)});
+ Console.WriteLine("WaitAny did not throw an " +
+ "exception, i = " + i);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonTheMutex()
+ {
+ Console.WriteLine("Acquire the Mutex");
+ myMutex.WaitOne();
+ Console.WriteLine("Holding the Mutex");
+ // Not calling ReleaseMutex() so the Mutex becomes abandoned
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex1a.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex1a.csproj
new file mode 100644
index 0000000000..5abdc80c22
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex1a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx1a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex2.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex2.cs
new file mode 100644
index 0000000000..aa27c0eea1
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex2.cs
@@ -0,0 +1,68 @@
+// 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.Threading;
+
+// This is a non-9x test
+
+class WaitAnyEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+
+ public WaitAnyEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ myMutex = new Mutex(false, Common.GetUniqueName());
+ }
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Testing Mutex and non-Mutex, " +
+ "and signaling the other element");
+ Thread t = new Thread(new ThreadStart(this.AbandonAndSet));
+ t.Start();
+ t.Join();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(
+ new WaitHandle[]{myMutex, myMRE}, 5000);
+ Console.WriteLine("WaitAny did not throw AbandonedMutexException");
+ }
+ catch(AbandonedMutexException)
+ {
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ finally
+ {
+ myMRE.Reset();
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAndSet()
+ {
+ Console.WriteLine("Acquire the Mutex");
+ myMutex.WaitOne();
+ Console.WriteLine("Holding the Mutex");
+ // Signaling the Event
+ myMRE.Set();
+ // Not calling ReleaseMutex() so the Mutex becomes abandoned
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex2.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex2.csproj
new file mode 100644
index 0000000000..ded25718b8
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex2.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx2.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex2a.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex2a.cs
new file mode 100644
index 0000000000..bbd2b018c6
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex2a.cs
@@ -0,0 +1,68 @@
+// 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.Threading;
+
+// This is a non-9x test
+
+class WaitAnyEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+
+ public WaitAnyEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ myMutex = new Mutex();
+ }
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Testing Mutex and non-Mutex, " +
+ "and signaling the other element");
+ Thread t = new Thread(new ThreadStart(this.AbandonAndSet));
+ t.Start();
+ t.Join();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(
+ new WaitHandle[]{myMutex, myMRE});
+ Console.WriteLine("WaitAny did not throw AbandonedMutexException");
+ }
+ catch(AbandonedMutexException)
+ {
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ finally
+ {
+ myMRE.Reset();
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAndSet()
+ {
+ Console.WriteLine("Acquire the Mutex");
+ myMutex.WaitOne();
+ Console.WriteLine("Holding the Mutex");
+ // Signaling the Event
+ myMRE.Set();
+ // Not calling ReleaseMutex() so the Mutex becomes abandoned
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex2a.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex2a.csproj
new file mode 100644
index 0000000000..9976547a83
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex2a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx2a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex3.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex3.cs
new file mode 100644
index 0000000000..e1160c5e73
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex3.cs
@@ -0,0 +1,81 @@
+// 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.Threading;
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandoning more than one mutex " +
+ "mix with other WaitHandles");
+ CreateArray(64);
+ myMRE = new ManualResetEvent(false);
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexes));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(wh, 10000);
+ Console.WriteLine("WaitAny did not throw an " +
+ "exception, i = " + i);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexes()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ switch(i%3)
+ {
+ case 0:
+ wh[i] = new ManualResetEvent(false);
+ break;
+ case 1:
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ break;
+ case 2:
+ wh[i] = new Semaphore(0,5);
+ break;
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex3.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex3.csproj
new file mode 100644
index 0000000000..06aaa5d7e6
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex3.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx3.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex3a.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex3a.cs
new file mode 100644
index 0000000000..f79cfa5cbf
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex3a.cs
@@ -0,0 +1,81 @@
+// 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.Threading;
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandoning more than one mutex " +
+ "mix with other WaitHandles");
+ CreateArray(64);
+ myMRE = new ManualResetEvent(false);
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexes));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(wh);
+ Console.WriteLine("WaitAny did not throw an " +
+ "exception, i = " + i);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexes()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ switch(i%3)
+ {
+ case 0:
+ wh[i] = new ManualResetEvent(false);
+ break;
+ case 1:
+ wh[i] = new Mutex();
+ break;
+ case 2:
+ wh[i] = new Semaphore(0,5);
+ break;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex3a.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex3a.csproj
new file mode 100644
index 0000000000..c0531d851e
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex3a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx3a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex4.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex4.cs
new file mode 100644
index 0000000000..a67aa329c6
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex4.cs
@@ -0,0 +1,76 @@
+// 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.Threading;
+
+// This is a non-9x test.
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandoning only one Mutex " +
+ "in array with other WaitHandles");
+ CreateArray(64);
+ Thread t = new Thread(new ThreadStart(this.AbandonOne));
+ t.Start();
+ t.Join();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(wh, 5000);
+ Console.WriteLine("WaitAny did not throw an exception");
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonOne()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ {
+ w.WaitOne();
+ break;
+ }
+ }
+ }
+
+ private void CreateArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ switch(i%3)
+ {
+ case 0:
+ wh[i] = new ManualResetEvent(false);
+ break;
+ case 1:
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ break;
+ case 2:
+ wh[i] = new Semaphore(0,5);
+ break;
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex4.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex4.csproj
new file mode 100644
index 0000000000..6829a55bd0
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex4.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx4.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex4a.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex4a.cs
new file mode 100644
index 0000000000..e3e45567e2
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex4a.cs
@@ -0,0 +1,76 @@
+// 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.Threading;
+
+// This is a non-9x test.
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandoning only one Mutex " +
+ "in array with other WaitHandles");
+ CreateArray(64);
+ Thread t = new Thread(new ThreadStart(this.AbandonOne));
+ t.Start();
+ t.Join();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(wh);
+ Console.WriteLine("WaitAny did not throw an exception");
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonOne()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ {
+ w.WaitOne();
+ break;
+ }
+ }
+ }
+
+ private void CreateArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ switch(i%3)
+ {
+ case 0:
+ wh[i] = new ManualResetEvent(false);
+ break;
+ case 1:
+ wh[i] = new Mutex();
+ break;
+ case 2:
+ wh[i] = new Semaphore(0,5);
+ break;
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex4a.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex4a.csproj
new file mode 100644
index 0000000000..3e33d568e8
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex4a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx4a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex5.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex5.cs
new file mode 100644
index 0000000000..cdd75e5f19
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex5.cs
@@ -0,0 +1,85 @@
+// 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.Threading;
+
+// This is a non-9x test.
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandoning only one Mutex in array " +
+ "with other WaitHandles, signaling other mutexes");
+ CreateArray(64);
+ Thread t = new Thread(new ThreadStart(this.AbandonOneAndRelease));
+ t.Start();
+ t.Join();
+ int i = -1;
+ try
+ {
+ Console.WriteLine("Waiting...");
+ i = WaitHandle.WaitAny(wh, 5000);
+ Console.WriteLine("WaitAny did not throw AbandonedMutexExcpetion");
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonOneAndRelease()
+ {
+ Mutex m = new Mutex();
+ bool bSet = false;
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ {
+ w.WaitOne();
+ if(bSet)
+ ((Mutex)w).ReleaseMutex();
+ bSet = true;
+ }
+ }
+ }
+
+ private void CreateArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ switch(i%3)
+ {
+ case 0:
+ wh[i] = new ManualResetEvent(false);
+ break;
+ case 1:
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ break;
+ case 2:
+ wh[i] = new Semaphore(0,5);
+ break;
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex5.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex5.csproj
new file mode 100644
index 0000000000..1a0bca3925
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex5.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx5.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex5a.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex5a.cs
new file mode 100644
index 0000000000..16c4e50e61
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex5a.cs
@@ -0,0 +1,85 @@
+// 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.Threading;
+
+// This is a non-9x test.
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandoning only one Mutex in array " +
+ "with other WaitHandles, signaling other mutexes");
+ CreateArray(64);
+ Thread t = new Thread(new ThreadStart(this.AbandonOneAndRelease));
+ t.Start();
+ t.Join();
+ int i = -1;
+ try
+ {
+ Console.WriteLine("Waiting...");
+ i = WaitHandle.WaitAny(wh);
+ Console.WriteLine("WaitAny did not throw AbandonedMutexExcpetion");
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonOneAndRelease()
+ {
+ Mutex m = new Mutex();
+ bool bSet = false;
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ {
+ w.WaitOne();
+ if(bSet)
+ ((Mutex)w).ReleaseMutex();
+ bSet = true;
+ }
+ }
+ }
+
+ private void CreateArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ switch(i%3)
+ {
+ case 0:
+ wh[i] = new ManualResetEvent(false);
+ break;
+ case 1:
+ wh[i] = new Mutex();
+ break;
+ case 2:
+ wh[i] = new Semaphore(0,5);
+ break;
+ }
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex5a.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex5a.csproj
new file mode 100644
index 0000000000..2592d55cbc
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex5a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx5a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex6.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex6.cs
new file mode 100644
index 0000000000..0f5b58658b
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex6.cs
@@ -0,0 +1,97 @@
+// 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.Threading;
+
+// This is a non-9x test.
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: WaitAnyEx6 /size:<int> /pos:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iPos=-1, iSize = -1;;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/size:"))
+ {
+ iSize = Convert.ToInt32(args[i].Substring(6));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/pos:"))
+ {
+ iPos = Convert.ToInt32(args[i].Substring(5));
+ }
+ }
+
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run(iSize, iPos);
+ }
+
+ private int Run(int iArraySize, int iPosToAbandon)
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon a particular mutex - " + iArraySize + ", " +
+ iPosToAbandon);
+ CreateMutexArray(iArraySize);
+ Thread t = new Thread(new
+ ParameterizedThreadStart(this.AbandonMutexPos));
+ t.Start(iPosToAbandon);
+ t.Join();
+ int i = -1;
+ try
+ {
+ Console.WriteLine("Waiting...");
+ i = WaitHandle.WaitAny(wh, 5000);
+ if(0 == iPosToAbandon)
+ Console.WriteLine("WaitAny didn't return an " +
+ "AbandonedMutexException");
+ else
+ // Expected to pass
+ iRet = 100;
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected if pos is first
+ if(0 == iPosToAbandon)
+ iRet = 100;
+ else
+ Console.WriteLine("WaitAny threw AbandonedMutexException " +
+ "and shouldn't have!");
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutexPos(Object o)
+ {
+ wh[Convert.ToInt32(o)].WaitOne();
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex6.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex6.csproj
new file mode 100644
index 0000000000..a24cfbd47f
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex6.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/size:2 /pos:1</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx6.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex6a.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex6a.cs
new file mode 100644
index 0000000000..89fde02a9e
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex6a.cs
@@ -0,0 +1,97 @@
+// 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.Threading;
+
+// This is a non-9x test.
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: WaitAnyEx6a /size:<int> /pos:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iPos=-1, iSize = -1;;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/size:"))
+ {
+ iSize = Convert.ToInt32(args[i].Substring(6));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/pos:"))
+ {
+ iPos = Convert.ToInt32(args[i].Substring(5));
+ }
+ }
+
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run(iSize, iPos);
+ }
+
+ private int Run(int iArraySize, int iPosToAbandon)
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon a particular mutex - " + iArraySize + ", " +
+ iPosToAbandon);
+ CreateMutexArray(iArraySize);
+ Thread t = new Thread(new
+ ParameterizedThreadStart(this.AbandonMutexPos));
+ t.Start(iPosToAbandon);
+ t.Join();
+ int i = -1;
+ try
+ {
+ Console.WriteLine("Waiting...");
+ i = WaitHandle.WaitAny(wh);
+ if(0 == iPosToAbandon)
+ Console.WriteLine("WaitAny didn't return an " +
+ "AbandonedMutexException");
+ else
+ // Expected to pass
+ iRet = 100;
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected if pos is first
+ if(iPosToAbandon == 0)
+ iRet = 100;
+ else
+ Console.WriteLine("WaitAny threw AbandonedMutexException " +
+ "and shouldn't have!");
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutexPos(Object o)
+ {
+ wh[Convert.ToInt32(o)].WaitOne();
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex();
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex6a.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex6a.csproj
new file mode 100644
index 0000000000..af6c467b40
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex6a.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/size:64 /pos:30</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx6a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex7.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex7.cs
new file mode 100644
index 0000000000..cc3108d0f2
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex7.cs
@@ -0,0 +1,69 @@
+// 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.Threading;
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon all mutexes in array");
+ CreateMutexArray(64);
+ myMRE = new ManualResetEvent(false);
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexes));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(wh, 10000);
+ Console.WriteLine("WaitAny did not throw an " +
+ "exception, i = " + i);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexes()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex7.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex7.csproj
new file mode 100644
index 0000000000..6d49f016b8
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex7.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx7.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex7a.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex7a.cs
new file mode 100644
index 0000000000..903b83c372
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex7a.cs
@@ -0,0 +1,69 @@
+// 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.Threading;
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+ private ManualResetEvent myMRE;
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon all mutexes in array");
+ CreateMutexArray(64);
+ myMRE = new ManualResetEvent(false);
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexes));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(wh);
+ Console.WriteLine("WaitAny did not throw an " +
+ "exception, i = " + i);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexes()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateMutexArray(int numElements)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ wh[i] = new Mutex();
+ }
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex7a.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex7a.csproj
new file mode 100644
index 0000000000..9b0747fda0
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex7a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx7a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex8.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex8.cs
new file mode 100644
index 0000000000..358ae5162b
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex8.cs
@@ -0,0 +1,59 @@
+// 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.Threading;
+
+// This is a non-9x test.
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon same named mutex");
+ // Create array with the same name
+ wh = new Mutex[2];
+ string sName = Common.GetUniqueName();
+ wh[0] = new Mutex(false, sName);
+ wh[1] = new Mutex(false, sName);
+
+ Thread t = new Thread(new
+ ParameterizedThreadStart(this.AbandonMutexPos));
+ t.Start(0);
+ t.Join();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(wh, 5000);
+ Console.WriteLine("WaitAny did not throw an " +
+ "exception, i = " + i);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutexPos(Object o)
+ {
+ wh[Convert.ToInt32(o)].WaitOne();
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex8.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex8.csproj
new file mode 100644
index 0000000000..940aff59ad
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex8.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx8.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex8a.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex8a.cs
new file mode 100644
index 0000000000..53f3fdaf53
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex8a.cs
@@ -0,0 +1,59 @@
+// 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.Threading;
+
+// This is a non-9x test.
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+
+ public static int Main()
+ {
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon same named mutex");
+ // Create array with the same name
+ wh = new Mutex[2];
+ string sName = Common.GetUniqueName();
+ wh[0] = new Mutex(false, sName);
+ wh[1] = new Mutex(false, sName);
+
+ Thread t = new Thread(new
+ ParameterizedThreadStart(this.AbandonMutexPos));
+ t.Start(0);
+ t.Join();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(wh);
+ Console.WriteLine("WaitAny did not throw an " +
+ "exception, i = " + i);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutexPos(Object o)
+ {
+ wh[Convert.ToInt32(o)].WaitOne();
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex8a.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex8a.csproj
new file mode 100644
index 0000000000..773ff5bd41
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex8a.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx8a.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex9.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex9.cs
new file mode 100644
index 0000000000..76b3006829
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex9.cs
@@ -0,0 +1,102 @@
+// 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.Threading;
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+ ManualResetEvent myMRE;
+
+ public WaitAnyEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: WaitAnyEx9 /size:<int> /pos:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iPos=-1, iSize = -1;;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/size:"))
+ {
+ iSize = Convert.ToInt32(args[i].Substring(6));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/pos:"))
+ {
+ iPos = Convert.ToInt32(args[i].Substring(5));
+ }
+ }
+
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run(iSize, iPos);
+ }
+
+ private int Run(int iNumElements, int iPos)
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon during a wait - " + iNumElements + ", " +
+ iPos);
+ CreateOneMutexArray(iNumElements, iPos);
+
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexesWait));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(wh, 10000);
+ Console.WriteLine("WaitAny did not throw an " +
+ "exception, i = " + i);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexesWait()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateOneMutexArray(int numElements, int iPos)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ if(i == iPos)
+ wh[i] = new Mutex(false, Common.GetUniqueName());
+ else
+ wh[i] = new ManualResetEvent(false);
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex9.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex9.csproj
new file mode 100644
index 0000000000..b3002f7b46
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex9.csproj
@@ -0,0 +1,40 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/size:2 /pos:1</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx9.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex9a.cs b/tests/src/baseservices/threading/waithandle/waitany/waitanyex9a.cs
new file mode 100644
index 0000000000..1c5817f9e0
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex9a.cs
@@ -0,0 +1,102 @@
+// 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.Threading;
+
+class WaitAnyEx
+{
+ WaitHandle[] wh;
+ ManualResetEvent myMRE;
+
+ public WaitAnyEx()
+ {
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main(string[] args)
+ {
+ // Check number of args
+ if(args.Length != 2)
+ {
+ Console.WriteLine("USAGE: WaitAnyEx9a /size:<int> /pos:<int>");
+ return -1;
+ }
+
+ // Get the args
+ int iPos=-1, iSize = -1;;
+
+ for(int i=0;i<args.Length;i++)
+ {
+ if(args[i].ToLower().StartsWith("/size:"))
+ {
+ iSize = Convert.ToInt32(args[i].Substring(6));
+ continue;
+ }
+
+ if(args[i].ToLower().StartsWith("/pos:"))
+ {
+ iPos = Convert.ToInt32(args[i].Substring(5));
+ }
+ }
+
+ WaitAnyEx wae = new WaitAnyEx();
+ return wae.Run(iSize, iPos);
+ }
+
+ private int Run(int iNumElements, int iPos)
+ {
+ int iRet = -1;
+ Console.WriteLine("Abandon during a wait - " + iNumElements + ", " +
+ iPos);
+ CreateOneMutexArray(iNumElements, iPos);
+
+ Thread t = new Thread(new ThreadStart(this.AbandonAllMutexesWait));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Waiting...");
+ int i = WaitHandle.WaitAny(wh);
+ Console.WriteLine("WaitAny did not throw an " +
+ "exception, i = " + i);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " +
+ e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonAllMutexesWait()
+ {
+ Mutex m = new Mutex();
+ foreach(WaitHandle w in wh)
+ {
+ if(w.GetType() == m.GetType())
+ w.WaitOne();
+ }
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+
+ private void CreateOneMutexArray(int numElements, int iPos)
+ {
+ wh = new WaitHandle[numElements];
+ for(int i=0;i<numElements;i++)
+ {
+ if(i == iPos)
+ wh[i] = new Mutex();
+ else
+ wh[i] = new ManualResetEvent(false);
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanyex9a.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanyex9a.csproj
new file mode 100644
index 0000000000..8a1d998b70
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanyex9a.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ <CLRTestExecutionArguments>/size:64 /pos:30</CLRTestExecutionArguments>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitAnyEx9a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitany/waitanynullarray.csproj b/tests/src/baseservices/threading/waithandle/waitany/waitanynullarray.csproj
new file mode 100644
index 0000000000..b815d5fb92
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitany/waitanynullarray.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="NullArray.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waithandlecommon.cs b/tests/src/baseservices/threading/waithandle/waithandlecommon.cs
new file mode 100644
index 0000000000..469e3a4a1f
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waithandlecommon.cs
@@ -0,0 +1,16 @@
+// 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.Threading;
+
+class Common
+{
+ public static string GetUniqueName()
+ {
+ string sName = Guid.NewGuid().ToString();
+ Console.WriteLine("Name created: " + sName);
+ return sName;
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex1.cs b/tests/src/baseservices/threading/waithandle/waitone/waitoneex1.cs
new file mode 100644
index 0000000000..b463ee5269
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex1.cs
@@ -0,0 +1,58 @@
+// 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.Threading;
+
+class WaitOneEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+
+ public WaitOneEx()
+ {
+ myMutex = new Mutex(false, Common.GetUniqueName());
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitOneEx wao = new WaitOneEx();
+ return wao.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Test abandoned mutex is thrown using WaitOne");
+ Thread t = new Thread(new ThreadStart(this.AbandonTheMutex));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Wait on an abandoned mutex");
+ bool bRet = myMutex.WaitOne(10000);
+ Console.WriteLine("WaitOne did not throw an exception!");
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonTheMutex()
+ {
+ Console.WriteLine("Acquire the Mutex");
+ myMutex.WaitOne();
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex1.csproj b/tests/src/baseservices/threading/waithandle/waitone/waitoneex1.csproj
new file mode 100644
index 0000000000..94a13fb2be
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex1.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitOneEx1.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex1a.cs b/tests/src/baseservices/threading/waithandle/waitone/waitoneex1a.cs
new file mode 100644
index 0000000000..b076ec6d8b
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex1a.cs
@@ -0,0 +1,58 @@
+// 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.Threading;
+
+class WaitOneEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+
+ public WaitOneEx()
+ {
+ myMutex = new Mutex();
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitOneEx wao = new WaitOneEx();
+ return wao.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Test abandoned mutex is thrown using WaitOne");
+ Thread t = new Thread(new ThreadStart(this.AbandonTheMutex));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Wait on an abandoned mutex");
+ bool bRet = myMutex.WaitOne();
+ Console.WriteLine("WaitOne did not throw an exception!");
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonTheMutex()
+ {
+ Console.WriteLine("Acquire the Mutex");
+ myMutex.WaitOne();
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex1a.csproj b/tests/src/baseservices/threading/waithandle/waitone/waitoneex1a.csproj
new file mode 100644
index 0000000000..1ab14798d8
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex1a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitOneEx1a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex2.cs b/tests/src/baseservices/threading/waithandle/waitone/waitoneex2.cs
new file mode 100644
index 0000000000..889e1541ca
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex2.cs
@@ -0,0 +1,59 @@
+// 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.Threading;
+
+class WaitOneEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+
+ public WaitOneEx()
+ {
+ myMutex = new Mutex(false, Common.GetUniqueName());
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitOneEx wao = new WaitOneEx();
+ return wao.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Test AbandonedMutexException is " +
+ "thrown when abandoned with a WaitAll");
+ Thread t = new Thread(new ThreadStart(this.AbandonMutexWaitAll));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Wait on an abandoned mutex");
+ bool bRet = myMutex.WaitOne(10000);
+ Console.WriteLine("WaitOne did not throw an exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutexWaitAll()
+ {
+ Console.WriteLine("Abandoning Mutex");
+ WaitHandle.WaitAll(new WaitHandle[]{myMutex, new Mutex()});
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex2.csproj b/tests/src/baseservices/threading/waithandle/waitone/waitoneex2.csproj
new file mode 100644
index 0000000000..0288033a9b
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex2.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitOneEx2.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex2a.cs b/tests/src/baseservices/threading/waithandle/waitone/waitoneex2a.cs
new file mode 100644
index 0000000000..4fa2ddb9ca
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex2a.cs
@@ -0,0 +1,59 @@
+// 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.Threading;
+
+class WaitOneEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+
+ public WaitOneEx()
+ {
+ myMutex = new Mutex();
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitOneEx wao = new WaitOneEx();
+ return wao.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Test AbandonedMutexException is " +
+ "thrown when abandoned with a WaitAll");
+ Thread t = new Thread(new ThreadStart(this.AbandonMutexWaitAll));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Wait on an abandoned mutex");
+ bool bRet = myMutex.WaitOne();
+ Console.WriteLine("WaitOne did not throw an exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutexWaitAll()
+ {
+ Console.WriteLine("Abandoning Mutex");
+ WaitHandle.WaitAll(new WaitHandle[]{myMutex, new Mutex()});
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex2a.csproj b/tests/src/baseservices/threading/waithandle/waitone/waitoneex2a.csproj
new file mode 100644
index 0000000000..48a323bf56
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex2a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitOneEx2a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex3.cs b/tests/src/baseservices/threading/waithandle/waitone/waitoneex3.cs
new file mode 100644
index 0000000000..85bd139354
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex3.cs
@@ -0,0 +1,59 @@
+// 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.Threading;
+
+class WaitOneEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+
+ public WaitOneEx()
+ {
+ myMutex = new Mutex(false, Common.GetUniqueName());
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitOneEx wao = new WaitOneEx();
+ return wao.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Test AbandonedMutexException is " +
+ "thrown when abandoned with a WaitAny");
+ Thread t = new Thread(new ThreadStart(this.AbandonMutexWaitAny));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Wait on an abandoned mutex");
+ bool bRet = myMutex.WaitOne(10000);
+ Console.WriteLine("WaitOne did not throw an exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutexWaitAny()
+ {
+ Console.WriteLine("Abandoning Mutex");
+ WaitHandle.WaitAny(new WaitHandle[]{new ManualResetEvent(false), myMutex});
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex3.csproj b/tests/src/baseservices/threading/waithandle/waitone/waitoneex3.csproj
new file mode 100644
index 0000000000..2af4abd9b8
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex3.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitOneEx3.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex3a.cs b/tests/src/baseservices/threading/waithandle/waitone/waitoneex3a.cs
new file mode 100644
index 0000000000..cefbda2670
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex3a.cs
@@ -0,0 +1,59 @@
+// 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.Threading;
+
+class WaitOneEx
+{
+ private Mutex myMutex;
+ private ManualResetEvent myMRE;
+
+ public WaitOneEx()
+ {
+ myMutex = new Mutex();
+ myMRE = new ManualResetEvent(false);
+ }
+
+ public static int Main()
+ {
+ WaitOneEx wao = new WaitOneEx();
+ return wao.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Test AbandonedMutexException is " +
+ "thrown when abandoned with a WaitAny");
+ Thread t = new Thread(new ThreadStart(this.AbandonMutexWaitAny));
+ t.Start();
+ myMRE.WaitOne();
+ try
+ {
+ Console.WriteLine("Wait on an abandoned mutex");
+ bool bRet = myMutex.WaitOne();
+ Console.WriteLine("WaitOne did not throw an exception, bRet = " + bRet);
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonMutexWaitAny()
+ {
+ Console.WriteLine("Abandoning Mutex");
+ WaitHandle.WaitAny(new WaitHandle[]{new ManualResetEvent(false), myMutex});
+ myMRE.Set();
+ Thread.Sleep(1000);
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex3a.csproj b/tests/src/baseservices/threading/waithandle/waitone/waitoneex3a.csproj
new file mode 100644
index 0000000000..7eee7ec63e
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex3a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitOneEx3a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex4.cs b/tests/src/baseservices/threading/waithandle/waitone/waitoneex4.cs
new file mode 100644
index 0000000000..0e79432f42
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex4.cs
@@ -0,0 +1,57 @@
+// 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.Threading;
+
+// This test is for non-9x platforms. 9x does not throw an AbandonedMutexException
+// when it is not actively waiting.
+
+class WaitOneEx
+{
+ private Mutex myMutex;
+
+ public WaitOneEx()
+ {
+ myMutex = new Mutex(false, Common.GetUniqueName());
+ }
+
+ public static int Main()
+ {
+ WaitOneEx wao = new WaitOneEx();
+ return wao.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Test abandoned mutex is thrown using WaitOne");
+ Thread t = new Thread(new ThreadStart(this.AbandonTheMutex));
+ t.Start();
+ t.Join();
+ try
+ {
+ Console.WriteLine("Wait on an abandoned mutex");
+ bool bRet = myMutex.WaitOne(10000);
+ Console.WriteLine("WaitOne did not throw an exception!");
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonTheMutex()
+ {
+ Console.WriteLine("Acquire the Mutex");
+ myMutex.WaitOne();
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex4.csproj b/tests/src/baseservices/threading/waithandle/waitone/waitoneex4.csproj
new file mode 100644
index 0000000000..e6eeaa4b91
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex4.csproj
@@ -0,0 +1,39 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitOneEx4.cs" />
+ <Compile Include="..\WaitHandleCommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex4a.cs b/tests/src/baseservices/threading/waithandle/waitone/waitoneex4a.cs
new file mode 100644
index 0000000000..a9ec241706
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex4a.cs
@@ -0,0 +1,57 @@
+// 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.Threading;
+
+// This test is for non-9x platforms. 9x does not throw an AbandonedMutexException
+// when it is not actively waiting.
+
+class WaitOneEx
+{
+ private Mutex myMutex;
+
+ public WaitOneEx()
+ {
+ myMutex = new Mutex();
+ }
+
+ public static int Main()
+ {
+ WaitOneEx wao = new WaitOneEx();
+ return wao.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ Console.WriteLine("Test abandoned mutex is thrown using WaitOne");
+ Thread t = new Thread(new ThreadStart(this.AbandonTheMutex));
+ t.Start();
+ t.Join();
+ try
+ {
+ Console.WriteLine("Wait on an abandoned mutex");
+ bool bRet = myMutex.WaitOne();
+ Console.WriteLine("WaitOne did not throw an exception!");
+ }
+ catch(AbandonedMutexException)
+ {
+ // Expected
+ iRet = 100;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Unexpected exception thrown: " + e.ToString());
+ }
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+
+ private void AbandonTheMutex()
+ {
+ Console.WriteLine("Acquire the Mutex");
+ myMutex.WaitOne();
+ }
+}
diff --git a/tests/src/baseservices/threading/waithandle/waitone/waitoneex4a.csproj b/tests/src/baseservices/threading/waithandle/waitone/waitoneex4a.csproj
new file mode 100644
index 0000000000..78720c5bd6
--- /dev/null
+++ b/tests/src/baseservices/threading/waithandle/waitone/waitoneex4a.csproj
@@ -0,0 +1,38 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="WaitOneEx4a.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/varargs/varargsupport.il b/tests/src/baseservices/varargs/varargsupport.il
new file mode 100644
index 0000000000..9db1068541
--- /dev/null
+++ b/tests/src/baseservices/varargs/varargsupport.il
@@ -0,0 +1,114 @@
+// 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.
+
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+.assembly extern legacy library mscorlib {}
+.assembly 'vafilt'
+{
+
+
+}
+.namespace App
+{
+ .class auto ansi Foo extends [mscorlib]System.Object
+ {
+ .field private class System.String text
+ .method family newslot virtual instance vararg class App.Foo VargFunc() il managed
+ {
+ .maxstack 2
+ .locals ([0] value class [mscorlib]System.ArgIterator args)
+ IL_0000: ldloca.s args
+ IL_0002: arglist
+ IL_0004: call instance void [mscorlib]System.ArgIterator::.ctor(value class [mscorlib]System.RuntimeArgumentHandle)
+ IL_0009: ldloca.s args
+ IL_000b: call instance typedref [mscorlib]System.ArgIterator::GetNextArg()
+ IL_0010: refanyval App.Foo
+ IL_0015: ldind.ref
+ IL_0016: ldfld class System.String App.Foo::text
+ IL_001b: call void [System.Console]System.Console::WriteLine(class System.String)
+ call void [mscorlib]System.GC::Collect()
+ IL_0020: newobj instance void App.Foo::.ctor()
+ IL_0025: ret
+ }
+
+ .method family newslot virtual instance class App.Foo VargFuncWrapper() il managed
+ {
+ .maxstack 3
+ .locals ([0] int32 zero)
+ try_begin:
+ newobj instance void App.Foo::.ctor()
+ newobj instance void App.Foo::.ctor()
+ callvirt instance vararg class App.Foo App.Foo::VargFunc(...,
+ class App.Foo
+ )
+ leave.s handler_end
+ filter_begin:
+ ldc.i4.0
+ endfilter
+ handler_begin:
+ pop
+ leave.s handler_end
+ handler_end:
+ IL_0020: newobj instance void App.Foo::.ctor()
+ ret
+ .try try_begin to filter_begin filter filter_begin handler handler_begin to handler_end
+ }
+
+
+ .method public static int32 Main(class System.String[] args) il managed
+ {
+ .entrypoint
+ .maxstack 3
+ .locals ([0] int32 zero)
+ try_begin:
+ ldc.i4 0x64
+ stloc.0
+ newobj instance void App.Foo::.ctor()
+ callvirt instance class App.Foo App.Foo::VargFuncWrapper()
+ ldstr "Test failed as InvalidProgramException was not raised."
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4.0
+ stloc.0
+ leave.s handler_end
+ filter_begin:
+ isinst [mscorlib]System.InvalidProgramException
+ brnull failed
+
+ ldc.i4.1
+ br exit_filter
+ failed:
+ ldstr "Test failed as InvalidProgramException was not raised."
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ ldc.i4.0
+ exit_filter:
+ endfilter
+ handler_begin:
+ pop
+ ldstr "*** test passed ***"
+ call void [System.Console]System.Console::WriteLine(class System.String)
+ leave.s handler_end
+ handler_end:
+ ldloc.0
+ ret
+ .try try_begin to filter_begin filter filter_begin handler handler_begin to handler_end
+ }
+
+ .method public specialname rtspecialname instance void .ctor() il managed
+ {
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldstr "Blah Blah"
+ IL_0006: stfld class System.String App.Foo::text
+ IL_000b: ldarg.0
+ IL_000c: call instance void [mscorlib]System.Object::.ctor()
+ IL_0011: ret
+ }
+
+ }
+
+}
diff --git a/tests/src/baseservices/varargs/varargsupport.ilproj b/tests/src/baseservices/varargs/varargsupport.ilproj
new file mode 100644
index 0000000000..1f207ac321
--- /dev/null
+++ b/tests/src/baseservices/varargs/varargsupport.ilproj
@@ -0,0 +1,40 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT .0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Full</DebugType>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="varargsupport.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/varargs/varargsupport_r.ilproj b/tests/src/baseservices/varargs/varargsupport_r.ilproj
new file mode 100644
index 0000000000..39e068117c
--- /dev/null
+++ b/tests/src/baseservices/varargs/varargsupport_r.ilproj
@@ -0,0 +1,37 @@
+<?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>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT .0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="varargsupport.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/baseservices/visibility/Target.csproj b/tests/src/baseservices/visibility/Target.csproj
new file mode 100644
index 0000000000..e246e127f0
--- /dev/null
+++ b/tests/src/baseservices/visibility/Target.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>SharedLibrary</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="target.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ <ProjectReference Include="../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/visibility/target.cs b/tests/src/baseservices/visibility/target.cs
new file mode 100644
index 0000000000..e20b983cb5
--- /dev/null
+++ b/tests/src/baseservices/visibility/target.cs
@@ -0,0 +1,520 @@
+// 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.Runtime.CompilerServices;
+using System.Security;
+
+[assembly: InternalsVisibleTo("ClassFriend, PublicKey=00240000048000009400000006020000002400005253413100040000010001000fc5993e0f511ad5e16e8b226553493e09067afc41039f70daeb94a968d664f40e69a46b617d15d3d5328be7dbedd059eb98495a3b03cb4ea4ba127444671c3c84cbc1fdc393d7e10b5ee3f31f5a29f005e5eed7e3c9c8af74f413f0004f0c2cabb22f9dd4f75a6f599784e1bab70985ef8174ca6c684278be82ce055a03ebaf")]
+[assembly: InternalsVisibleTo("StaticClassFriend, PublicKey=00240000048000009400000006020000002400005253413100040000010001000fc5993e0f511ad5e16e8b226553493e09067afc41039f70daeb94a968d664f40e69a46b617d15d3d5328be7dbedd059eb98495a3b03cb4ea4ba127444671c3c84cbc1fdc393d7e10b5ee3f31f5a29f005e5eed7e3c9c8af74f413f0004f0c2cabb22f9dd4f75a6f599784e1bab70985ef8174ca6c684278be82ce055a03ebaf")]
+[assembly: InternalsVisibleTo("StructFriend, PublicKey=00240000048000009400000006020000002400005253413100040000010001000fc5993e0f511ad5e16e8b226553493e09067afc41039f70daeb94a968d664f40e69a46b617d15d3d5328be7dbedd059eb98495a3b03cb4ea4ba127444671c3c84cbc1fdc393d7e10b5ee3f31f5a29f005e5eed7e3c9c8af74f413f0004f0c2cabb22f9dd4f75a6f599784e1bab70985ef8174ca6c684278be82ce055a03ebaf")]
+
+
+//
+// This file can be compiled in two ways: ALL public (ALL_PUB), or Restricted.
+// The intention of the ALL public (ALL_PUB) is to allow a C# caller to build.
+// The restricted version is intended to be used at runtime, causing some
+// calls to fail.
+//
+
+//
+// Enum
+//
+#if ALL_PUB
+public
+#endif
+ enum DefaultEnum { VALUE1, VALUE3 }
+public enum PublicEnum { VALUE1, VALUE3 }
+
+#if ALL_PUB
+public enum InternalEnum { VALUE1, VALUE3 }
+#else
+internal enum InternalEnum { VALUE1, VALUE3 }
+#endif
+
+
+
+//
+// Class
+//
+#if ALL_PUB
+ public
+#endif
+ class DefaultClass
+{
+}
+
+public class PublicClass
+{
+ //
+ // Ctors
+ //
+ public PublicClass() {}
+#if ALL_PUB
+ public
+#endif
+ PublicClass(int i1) {}
+ public PublicClass(int i1, int i2) {}
+#if ALL_PUB
+ public PublicClass(int i1, int i2, int i3) {}
+ public PublicClass(int i1, int i2, int i3, int i4) {}
+ public PublicClass(int i1, int i2, int i3, int i4, int i5) {}
+ public PublicClass(int i1, int i2, int i3, int i4, int i5, int i6) {}
+#else
+ protected PublicClass(int i1, int i2, int i3) {}
+ internal PublicClass(int i1, int i2, int i3, int i4) {}
+ protected internal PublicClass(int i1, int i2, int i3, int i4, int i5) {}
+ private PublicClass(int i1, int i2, int i3, int i4, int i5, int i6) {}
+#endif
+
+
+ //
+ // static fields
+ //
+#pragma warning disable 169
+#if ALL_PUB
+ public
+#endif
+ static int defaultStaticField;
+ public static int publicStaticField = 0;
+#if ALL_PUB
+ public static int protectedStaticField = 0;
+ public static int internalStaticField = 0;
+ public static int protectedInternalStaticField = 0;
+ public static int privateStaticField;
+#else
+ protected static int protectedStaticField = 0;
+ internal static int internalStaticField = 0;
+ protected internal static int protectedInternalStaticField = 0;
+ private static int privateStaticField;
+#endif
+
+
+ //
+ // instance fields
+ //
+#if ALL_PUB
+ public
+#endif
+ int defaultField;
+ public int publicField;
+#if ALL_PUB
+ public int protectedField;
+ public int internalField;
+ public int protectedInternalField;
+ public int privateField;
+#else
+ protected int protectedField;
+ internal int internalField;
+ protected internal int protectedInternalField;
+ private int privateField;
+#endif
+
+#pragma warning restore 169
+ //
+ // static Properties
+ //
+#if ALL_PUB
+ public
+#endif
+ static int DefaultStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ public static int PublicStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+#if ALL_PUB
+ public static int ProtectedStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ public static int InternalStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ public static int ProtectedInternalStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ public static int PrivateStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+#else
+ protected static int ProtectedStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ internal static int InternalStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ protected internal static int ProtectedInternalStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ private static int PrivateStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+#endif
+
+ //
+ // instance Properties
+ //
+#if ALL_PUB
+ public
+#endif
+ int DefaultProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ public int PublicProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+#if ALL_PUB
+ public int ProtectedProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ public int InternalProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ public int ProtectedInternalProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ public int PrivateProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+#else
+ protected int ProtectedProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ internal int InternalProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ protected internal int ProtectedInternalProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ private int PrivateProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+#endif
+
+
+ //
+ // static Methods
+ //
+#if ALL_PUB
+ public
+#endif
+ static int DefaultStaticMethod() { return 1; }
+ public static int PublicStaticMethod() { return 1; }
+#if ALL_PUB
+ public static int ProtectedStaticMethod() { return 1; }
+ public static int InternalStaticMethod() { return 1; }
+ public static int ProtectedInternalStaticMethod() { return 1; }
+ public static int PrivateStaticMethod() { return 1; }
+#else
+ protected static int ProtectedStaticMethod() { return 1; }
+ internal static int InternalStaticMethod() { return 1; }
+ protected internal static int ProtectedInternalStaticMethod() { return 1; }
+ private static int PrivateStaticMethod() { return 1; }
+#endif
+
+
+ //
+ // instance Methods
+ //
+#if ALL_PUB
+ public
+#endif
+ int DefaultMethod() { return 1; }
+ public int PublicMethod() { return 1; }
+#if ALL_PUB
+ public int ProtectedMethod() { return 1; }
+ public int InternalMethod() { return 1; }
+ public int ProtectedInternalMethod() { return 1; }
+ public int PrivateMethod() { return 1; }
+#else
+ protected int ProtectedMethod() { return 1; }
+ internal int InternalMethod() { return 1; }
+ protected internal int ProtectedInternalMethod() { return 1; }
+ private int PrivateMethod() { return 1; }
+#endif
+}
+
+#if ALL_PUB
+public class InternalClass
+#else
+internal class InternalClass
+#endif
+{
+}
+
+
+//
+// Static Class
+//
+#if ALL_PUB
+public
+#endif
+ static class DefaultStaticClass
+{
+ public static int field = 0;
+}
+
+public static class PublicStaticClass
+{
+ public static int field = 0;
+}
+
+#if ALL_PUB
+public static class InternalStaticClass
+#else
+internal static class InternalStaticClass
+#endif
+{
+ public static int field = 0;
+}
+
+
+//
+// Interface
+//
+#if ALL_PUB
+public
+#endif
+ interface DefaultInterface
+{
+ bool Foo();
+}
+
+
+public interface PublicInterface
+{
+ bool Foo();
+}
+
+#if ALL_PUB
+public interface InternalInterface
+#else
+internal interface InternalInterface
+#endif
+{
+ bool Foo();
+}
+
+
+//
+// Struct
+//
+#if ALL_PUB
+ public
+#endif
+ struct DefaultStruct {}
+public struct PublicStruct
+{
+ //
+ // Ctors
+ //
+#if ALL_PUB
+ public
+#endif
+ PublicStruct(int i1) {defaultField=publicField=internalField=privateField=0;}
+ public PublicStruct(int i1, int i2) {defaultField=publicField=internalField=privateField=0;}
+#if ALL_PUB
+ public PublicStruct(int i1, int i2, int i3) {defaultField=publicField=internalField=privateField=0;}
+ public PublicStruct(int i1, int i2, int i3, int i4) {defaultField=publicField=internalField=privateField=0;}
+#else
+ internal PublicStruct(int i1, int i2, int i3) {defaultField=publicField=internalField=privateField=0;}
+ private PublicStruct(int i1, int i2, int i3, int i4) {defaultField=publicField=internalField=privateField=0;}
+#endif
+
+#pragma warning disable 414
+ //
+ // static fields
+ //
+#if ALL_PUB
+ public
+#endif
+ static int defaultStaticField = 0;
+ public static int publicStaticField = 0;
+#if ALL_PUB
+ public static int internalStaticField = 0;
+ public static int privateStaticField = 0;
+#else
+ internal static int internalStaticField = 0;
+ private static int privateStaticField = 0;
+#endif
+
+
+ //
+ // instance fields
+ //
+#if ALL_PUB
+ public
+#endif
+ int defaultField;
+ public int publicField;
+#if ALL_PUB
+ public int internalField;
+ public int privateField;
+#else
+ internal int internalField;
+ private int privateField;
+#endif
+
+#pragma warning restore 414
+ //
+ // static Properties
+ //
+#if ALL_PUB
+ public
+#endif
+ static int DefaultStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ public static int PublicStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+#if ALL_PUB
+ public static int InternalStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ public static int PrivateStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+#else
+ internal static int InternalStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ private static int PrivateStaticProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+#endif
+
+ //
+ // instance Properties
+ //
+#if ALL_PUB
+ public
+#endif
+ int DefaultProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ public int PublicProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+#if ALL_PUB
+ public int InternalProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ public int PrivateProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+#else
+ internal int InternalProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+ private int PrivateProperty
+ {
+ get { return 0; }
+ set { ; }
+ }
+#endif
+
+
+ //
+ // static Methods
+ //
+#if ALL_PUB
+ public
+#endif
+ static int DefaultStaticMethod() { return 1; }
+ public static int PublicStaticMethod() { return 1; }
+#if ALL_PUB
+ public static int InternalStaticMethod() { return 1; }
+ public static int PrivateStaticMethod() { return 1; }
+#else
+ internal static int InternalStaticMethod() { return 1; }
+ private static int PrivateStaticMethod() { return 1; }
+#endif
+
+
+ //
+ // instance Methods
+ //
+#if ALL_PUB
+ public
+#endif
+ int DefaultMethod() { return 1; }
+ public int PublicMethod() { return 1; }
+#if ALL_PUB
+ public int InternalMethod() { return 1; }
+ public int PrivateMethod() { return 1; }
+#else
+ internal int InternalMethod() { return 1; }
+ private int PrivateMethod() { return 1; }
+#endif
+}
+
+#if ALL_PUB
+public struct InternalStruct {};
+#else
+internal struct InternalStruct {};
+#endif
+
+