summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAditya Mandaleeka <adityamandaleeka@users.noreply.github.com>2016-03-04 12:27:06 -0800
committerAditya Mandaleeka <adityamandaleeka@users.noreply.github.com>2016-03-04 12:27:06 -0800
commitf1edbd345b2f76dc9bee2917c08e5992ddf506fd (patch)
tree7b13a26017bdca16df33346357ed493042dbb13b /tests
parent943014f2b621925a3722648f96ec2ee125747e43 (diff)
parent1a733823af3a15b8572511953a5b039148dbc48e (diff)
downloadcoreclr-f1edbd345b2f76dc9bee2917c08e5992ddf506fd.tar.gz
coreclr-f1edbd345b2f76dc9bee2917c08e5992ddf506fd.tar.bz2
coreclr-f1edbd345b2f76dc9bee2917c08e5992ddf506fd.zip
Merge pull request #3497 from adityamandaleeka/threading_test_port
[WIP] Open source some more threading tests
Diffstat (limited to 'tests')
-rw-r--r--tests/src/baseservices/threading/commitstackonlyasneeded/DefaultStackCommit.cs29
-rw-r--r--tests/src/baseservices/threading/commitstackonlyasneeded/DefaultStackCommit.csproj45
-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/commitstackonlyasneeded/project.json34
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_ARENullRefEx.cs150
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_ARENullRefEx.csproj44
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_MRENullRefEx.cs150
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_MRENullRefEx.csproj44
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_MutexNullRefEx.cs142
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_MutexNullRefEx.csproj44
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.cs76
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.csproj44
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_SLENullRefEx.cs125
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_SLENullRefEx.csproj44
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_TSNullRefEx.cs124
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_TSNullRefEx.csproj44
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_TimerNullRefEx.cs114
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_TimerNullRefEx.csproj44
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_WHNullRefEx.cs134
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_WHNullRefEx.csproj44
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/project.json35
-rw-r--r--tests/src/baseservices/threading/events/AutoResetEvent/ConstructFalse.cs68
-rw-r--r--tests/src/baseservices/threading/events/AutoResetEvent/ConstructFalse.csproj44
-rw-r--r--tests/src/baseservices/threading/events/AutoResetEvent/ConstructTrue.cs50
-rw-r--r--tests/src/baseservices/threading/events/AutoResetEvent/ConstructTrue.csproj44
-rw-r--r--tests/src/baseservices/threading/events/AutoResetEvent/project.json34
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast1.cs45
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast1.csproj47
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast2.cs50
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast2.csproj47
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor1.cs45
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor1.csproj47
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor2.cs50
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor2.csproj47
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/project.json35
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast1.cs47
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast1.csproj47
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast2.cs48
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast2.csproj47
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor1.cs47
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor1.csproj47
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor2.cs48
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor2.csproj47
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/project.json34
-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.csproj45
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructTrue.cs28
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructTrue.csproj45
-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.csproj45
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructTrue.cs34
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructTrue.csproj45
-rw-r--r--tests/src/baseservices/threading/events/EventWaitHandle/unit/project.json34
-rw-r--r--tests/src/baseservices/threading/events/ManualResetEvent/ConstructFalse.cs58
-rw-r--r--tests/src/baseservices/threading/events/ManualResetEvent/ConstructFalse.csproj44
-rw-r--r--tests/src/baseservices/threading/events/ManualResetEvent/ConstructTrue.cs36
-rw-r--r--tests/src/baseservices/threading/events/ManualResetEvent/ConstructTrue.csproj44
-rw-r--r--tests/src/baseservices/threading/events/ManualResetEvent/project.json34
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit01.cs94
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit01.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit02.cs167
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit02.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit03.cs99
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit03.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit04.cs172
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit04.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit05.cs99
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit05.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit06.cs171
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit06.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit07.cs98
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit07.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit08.cs171
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit08.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit09.cs97
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit09.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit10.cs113
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit10.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit11.cs102
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit11.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit12.cs179
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit12.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit13.cs101
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit13.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit14.cs178
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/EnterExit14.csproj45
-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.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter03.cs177
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter03.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter04.cs99
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter04.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter05.cs99
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter05.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter06.cs177
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/TryEnter06.csproj45
-rw-r--r--tests/src/baseservices/threading/generics/Monitor/project.json34
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/project.json35
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread01.cs84
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread01.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread02.cs84
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread02.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread03.cs80
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread03.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread04.cs80
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread04.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread05.cs80
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread05.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread06.cs80
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread06.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread07.cs84
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread07.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread08.cs80
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread08.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread09.cs80
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread09.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread10.cs93
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread10.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread11.cs93
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread11.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread12.cs93
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread12.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread13.cs219
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread13.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread14.cs219
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread14.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread15.cs219
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread15.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread16.cs85
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread16.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread17.cs85
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread17.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread18.cs85
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread18.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread19.cs89
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread19.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread20.cs89
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread20.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread21.cs89
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread21.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread22.cs243
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread22.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread23.cs243
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread23.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread24.cs243
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread24.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread25.cs82
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread25.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread26.cs82
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread26.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread27.cs78
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread27.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread28.cs78
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread28.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread29.cs78
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread29.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread30.cs78
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/thread30.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/tighttimercallback.cs91
-rw-r--r--tests/src/baseservices/threading/generics/TimerCallback/tighttimercallback.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/project.json34
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread01.cs84
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread01.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread02.cs84
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread02.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread03.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread03.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread04.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread04.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread05.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread05.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread06.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread06.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread07.cs84
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread07.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread08.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread08.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread09.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread09.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread10.cs94
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread10.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread11.cs94
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread11.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread12.cs94
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread12.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread13.cs236
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread13.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread14.cs236
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread14.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread15.cs236
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread15.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread16.cs85
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread16.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread17.cs85
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread17.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread18.cs85
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread18.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread19.cs89
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread19.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread20.cs89
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread20.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread21.cs89
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread21.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread22.cs271
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread22.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread23.cs269
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread23.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread24.cs267
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread24.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread25.cs84
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread25.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread26.cs86
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread26.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread27.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread27.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread28.cs80
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread28.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread29.cs78
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread29.csproj44
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread30.cs78
-rw-r--r--tests/src/baseservices/threading/generics/WaitCallback/thread30.csproj44
-rw-r--r--tests/testsUnsupportedOutsideWindows.txt1
227 files changed, 16741 insertions, 0 deletions
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..7913874a14
--- /dev/null
+++ b/tests/src/baseservices/threading/commitstackonlyasneeded/DefaultStackCommit.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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/commitstackonlyasneeded/project.json b/tests/src/baseservices/threading/commitstackonlyasneeded/project.json
new file mode 100644
index 0000000000..c14efc6fd1
--- /dev/null
+++ b/tests/src/baseservices/threading/commitstackonlyasneeded/project.json
@@ -0,0 +1,34 @@
+{
+ "dependencies": {
+ "System.Diagnostics.Process": "4.0.0-beta-23302",
+ "System.IO": "4.0.10-beta-23302",
+ "System.IO.FileSystem": "4.0.0-beta-23302",
+ "System.IO.FileSystem.Primitives": "4.0.0-beta-23302",
+ "System.Runtime": "4.0.20-beta-23302",
+ "System.Runtime.Extensions": "4.0.10-beta-23302",
+ "System.Runtime.Handles": "4.0.0-beta-23302",
+ "System.Runtime.Loader": "4.0.0-beta-23302",
+ "System.Threading": "4.0.10-beta-23302",
+ "System.Threading.AccessControl": "4.0.0-rc3-23823",
+ "System.Globalization.Calendars": "4.0.0-beta-23302",
+ "System.Globalization": "4.0.10-beta-23302",
+ "System.Text.Encoding": "4.0.10-beta-23302",
+ "System.Runtime.InteropServices": "4.0.20-beta-23302",
+ "System.Collections": "4.0.10-beta-23302",
+ "System.Console": "4.0.0-beta-23302",
+ "System.Reflection": "4.0.10-beta-23302",
+ "System.Reflection.Primitives": "4.0.0-beta-23302",
+ "System.ComponentModel": "4.0.1-beta-23302",
+ "System.Xml.ReaderWriter": "4.0.11-beta-23302",
+ "System.Collections.NonGeneric": "4.0.1-beta-23302",
+ "System.Collections.Specialized": "4.0.1-beta-23302",
+ "System.Linq": "4.0.1-beta-23302",
+ "System.Linq.Queryable": "4.0.1-beta-23302",
+ "System.Xml.XmlSerializer": "4.0.11-beta-23302",
+ "System.Xml.XmlDocument": "4.0.1-beta-23302",
+ "System.Xml.XDocument": "4.0.11-beta-23302"
+ },
+ "frameworks": {
+ "dnxcore50": {}
+ }
+} \ 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..3b4dbb1848
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_ARENullRefEx.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="CS_ARENullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..0593a5c35f
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_MRENullRefEx.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="CS_MRENullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..df81430317
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_MutexNullRefEx.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="CS_MutexNullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..3ecc186235
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.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="CS_RWHNullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..e853645d30
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_SLENullRefEx.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="CS_SLENullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..90705e2173
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_TSNullRefEx.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="CS_TSNullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..472c85a8f6
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_TimerNullRefEx.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="CS_TimerNullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..c315ca07e8
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_WHNullRefEx.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="CS_WHNullRefEx.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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/project.json b/tests/src/baseservices/threading/coverage/Nullref/project.json
new file mode 100644
index 0000000000..864cd20ce2
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/project.json
@@ -0,0 +1,35 @@
+{
+ "dependencies": {
+ "System.Diagnostics.Process": "4.0.0-beta-23302",
+ "System.IO": "4.0.10-beta-23302",
+ "System.IO.FileSystem": "4.0.0-beta-23302",
+ "System.IO.FileSystem.Primitives": "4.0.0-beta-23302",
+ "System.Runtime": "4.0.20-beta-23302",
+ "System.Runtime.Extensions": "4.0.10-beta-23302",
+ "System.Runtime.Handles": "4.0.0-beta-23302",
+ "System.Runtime.Loader": "4.0.0-beta-23302",
+ "System.Threading": "4.0.10-beta-23302",
+ "System.Threading.Timer": "4.0.0-rc3-23823",
+ "System.Threading.AccessControl": "4.0.0-rc3-23823",
+ "System.Globalization.Calendars": "4.0.0-beta-23302",
+ "System.Globalization": "4.0.10-beta-23302",
+ "System.Text.Encoding": "4.0.10-beta-23302",
+ "System.Runtime.InteropServices": "4.0.20-beta-23302",
+ "System.Collections": "4.0.10-beta-23302",
+ "System.Console": "4.0.0-beta-23302",
+ "System.Reflection": "4.0.10-beta-23302",
+ "System.Reflection.Primitives": "4.0.0-beta-23302",
+ "System.ComponentModel": "4.0.1-beta-23302",
+ "System.Xml.ReaderWriter": "4.0.11-beta-23302",
+ "System.Collections.NonGeneric": "4.0.1-beta-23302",
+ "System.Collections.Specialized": "4.0.1-beta-23302",
+ "System.Linq": "4.0.1-beta-23302",
+ "System.Linq.Queryable": "4.0.1-beta-23302",
+ "System.Xml.XmlSerializer": "4.0.11-beta-23302",
+ "System.Xml.XmlDocument": "4.0.1-beta-23302",
+ "System.Xml.XDocument": "4.0.11-beta-23302"
+ },
+ "frameworks": {
+ "dnxcore50": {}
+ }
+} \ 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..3a717d371b
--- /dev/null
+++ b/tests/src/baseservices/threading/events/AutoResetEvent/ConstructFalse.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..90391fc441
--- /dev/null
+++ b/tests/src/baseservices/threading/events/AutoResetEvent/ConstructTrue.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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/project.json b/tests/src/baseservices/threading/events/AutoResetEvent/project.json
new file mode 100644
index 0000000000..c14efc6fd1
--- /dev/null
+++ b/tests/src/baseservices/threading/events/AutoResetEvent/project.json
@@ -0,0 +1,34 @@
+{
+ "dependencies": {
+ "System.Diagnostics.Process": "4.0.0-beta-23302",
+ "System.IO": "4.0.10-beta-23302",
+ "System.IO.FileSystem": "4.0.0-beta-23302",
+ "System.IO.FileSystem.Primitives": "4.0.0-beta-23302",
+ "System.Runtime": "4.0.20-beta-23302",
+ "System.Runtime.Extensions": "4.0.10-beta-23302",
+ "System.Runtime.Handles": "4.0.0-beta-23302",
+ "System.Runtime.Loader": "4.0.0-beta-23302",
+ "System.Threading": "4.0.10-beta-23302",
+ "System.Threading.AccessControl": "4.0.0-rc3-23823",
+ "System.Globalization.Calendars": "4.0.0-beta-23302",
+ "System.Globalization": "4.0.10-beta-23302",
+ "System.Text.Encoding": "4.0.10-beta-23302",
+ "System.Runtime.InteropServices": "4.0.20-beta-23302",
+ "System.Collections": "4.0.10-beta-23302",
+ "System.Console": "4.0.0-beta-23302",
+ "System.Reflection": "4.0.10-beta-23302",
+ "System.Reflection.Primitives": "4.0.0-beta-23302",
+ "System.ComponentModel": "4.0.1-beta-23302",
+ "System.Xml.ReaderWriter": "4.0.11-beta-23302",
+ "System.Collections.NonGeneric": "4.0.1-beta-23302",
+ "System.Collections.Specialized": "4.0.1-beta-23302",
+ "System.Linq": "4.0.1-beta-23302",
+ "System.Linq.Queryable": "4.0.1-beta-23302",
+ "System.Xml.XmlSerializer": "4.0.11-beta-23302",
+ "System.Xml.XmlDocument": "4.0.1-beta-23302",
+ "System.Xml.XDocument": "4.0.11-beta-23302"
+ },
+ "frameworks": {
+ "dnxcore50": {}
+ }
+} \ 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..39506ecccd
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast1.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>{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>
+ <None Include="project.json" />
+ </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..1cff8e1cf5
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCast2.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>{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>
+ <None Include="project.json" />
+ </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..aa079c7d18
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor1.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>{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>
+ <None Include="project.json" />
+ </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..db205f8489
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/AutoResetCtor2.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>{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>
+ <None Include="project.json" />
+ </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/project.json b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/project.json
new file mode 100644
index 0000000000..864cd20ce2
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/AutoReset/project.json
@@ -0,0 +1,35 @@
+{
+ "dependencies": {
+ "System.Diagnostics.Process": "4.0.0-beta-23302",
+ "System.IO": "4.0.10-beta-23302",
+ "System.IO.FileSystem": "4.0.0-beta-23302",
+ "System.IO.FileSystem.Primitives": "4.0.0-beta-23302",
+ "System.Runtime": "4.0.20-beta-23302",
+ "System.Runtime.Extensions": "4.0.10-beta-23302",
+ "System.Runtime.Handles": "4.0.0-beta-23302",
+ "System.Runtime.Loader": "4.0.0-beta-23302",
+ "System.Threading": "4.0.10-beta-23302",
+ "System.Threading.Timer": "4.0.0-rc3-23823",
+ "System.Threading.AccessControl": "4.0.0-rc3-23823",
+ "System.Globalization.Calendars": "4.0.0-beta-23302",
+ "System.Globalization": "4.0.10-beta-23302",
+ "System.Text.Encoding": "4.0.10-beta-23302",
+ "System.Runtime.InteropServices": "4.0.20-beta-23302",
+ "System.Collections": "4.0.10-beta-23302",
+ "System.Console": "4.0.0-beta-23302",
+ "System.Reflection": "4.0.10-beta-23302",
+ "System.Reflection.Primitives": "4.0.0-beta-23302",
+ "System.ComponentModel": "4.0.1-beta-23302",
+ "System.Xml.ReaderWriter": "4.0.11-beta-23302",
+ "System.Collections.NonGeneric": "4.0.1-beta-23302",
+ "System.Collections.Specialized": "4.0.1-beta-23302",
+ "System.Linq": "4.0.1-beta-23302",
+ "System.Linq.Queryable": "4.0.1-beta-23302",
+ "System.Xml.XmlSerializer": "4.0.11-beta-23302",
+ "System.Xml.XmlDocument": "4.0.1-beta-23302",
+ "System.Xml.XDocument": "4.0.11-beta-23302"
+ },
+ "frameworks": {
+ "dnxcore50": {}
+ }
+} \ 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..3556eb903f
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast1.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>{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>
+ <None Include="project.json" />
+ </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..39f4e73da3
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCast2.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>{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>
+ <None Include="project.json" />
+ </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..b9454a9041
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor1.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>{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>
+ <None Include="project.json" />
+ </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..b3781447c3
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/ManualResetCtor2.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>{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>
+ <None Include="project.json" />
+ </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/project.json b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/project.json
new file mode 100644
index 0000000000..c14efc6fd1
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/ManualReset/project.json
@@ -0,0 +1,34 @@
+{
+ "dependencies": {
+ "System.Diagnostics.Process": "4.0.0-beta-23302",
+ "System.IO": "4.0.10-beta-23302",
+ "System.IO.FileSystem": "4.0.0-beta-23302",
+ "System.IO.FileSystem.Primitives": "4.0.0-beta-23302",
+ "System.Runtime": "4.0.20-beta-23302",
+ "System.Runtime.Extensions": "4.0.10-beta-23302",
+ "System.Runtime.Handles": "4.0.0-beta-23302",
+ "System.Runtime.Loader": "4.0.0-beta-23302",
+ "System.Threading": "4.0.10-beta-23302",
+ "System.Threading.AccessControl": "4.0.0-rc3-23823",
+ "System.Globalization.Calendars": "4.0.0-beta-23302",
+ "System.Globalization": "4.0.10-beta-23302",
+ "System.Text.Encoding": "4.0.10-beta-23302",
+ "System.Runtime.InteropServices": "4.0.20-beta-23302",
+ "System.Collections": "4.0.10-beta-23302",
+ "System.Console": "4.0.0-beta-23302",
+ "System.Reflection": "4.0.10-beta-23302",
+ "System.Reflection.Primitives": "4.0.0-beta-23302",
+ "System.ComponentModel": "4.0.1-beta-23302",
+ "System.Xml.ReaderWriter": "4.0.11-beta-23302",
+ "System.Collections.NonGeneric": "4.0.1-beta-23302",
+ "System.Collections.Specialized": "4.0.1-beta-23302",
+ "System.Linq": "4.0.1-beta-23302",
+ "System.Linq.Queryable": "4.0.1-beta-23302",
+ "System.Xml.XmlSerializer": "4.0.11-beta-23302",
+ "System.Xml.XmlDocument": "4.0.1-beta-23302",
+ "System.Xml.XDocument": "4.0.11-beta-23302"
+ },
+ "frameworks": {
+ "dnxcore50": {}
+ }
+} \ 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..7b62f601c9
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructFalse.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..a21f76453f
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/unit/AutoConstructTrue.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..060324a664
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructFalse.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..ae99f88d8c
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/unit/ManualConstructTrue.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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/project.json b/tests/src/baseservices/threading/events/EventWaitHandle/unit/project.json
new file mode 100644
index 0000000000..c14efc6fd1
--- /dev/null
+++ b/tests/src/baseservices/threading/events/EventWaitHandle/unit/project.json
@@ -0,0 +1,34 @@
+{
+ "dependencies": {
+ "System.Diagnostics.Process": "4.0.0-beta-23302",
+ "System.IO": "4.0.10-beta-23302",
+ "System.IO.FileSystem": "4.0.0-beta-23302",
+ "System.IO.FileSystem.Primitives": "4.0.0-beta-23302",
+ "System.Runtime": "4.0.20-beta-23302",
+ "System.Runtime.Extensions": "4.0.10-beta-23302",
+ "System.Runtime.Handles": "4.0.0-beta-23302",
+ "System.Runtime.Loader": "4.0.0-beta-23302",
+ "System.Threading": "4.0.10-beta-23302",
+ "System.Threading.AccessControl": "4.0.0-rc3-23823",
+ "System.Globalization.Calendars": "4.0.0-beta-23302",
+ "System.Globalization": "4.0.10-beta-23302",
+ "System.Text.Encoding": "4.0.10-beta-23302",
+ "System.Runtime.InteropServices": "4.0.20-beta-23302",
+ "System.Collections": "4.0.10-beta-23302",
+ "System.Console": "4.0.0-beta-23302",
+ "System.Reflection": "4.0.10-beta-23302",
+ "System.Reflection.Primitives": "4.0.0-beta-23302",
+ "System.ComponentModel": "4.0.1-beta-23302",
+ "System.Xml.ReaderWriter": "4.0.11-beta-23302",
+ "System.Collections.NonGeneric": "4.0.1-beta-23302",
+ "System.Collections.Specialized": "4.0.1-beta-23302",
+ "System.Linq": "4.0.1-beta-23302",
+ "System.Linq.Queryable": "4.0.1-beta-23302",
+ "System.Xml.XmlSerializer": "4.0.11-beta-23302",
+ "System.Xml.XmlDocument": "4.0.1-beta-23302",
+ "System.Xml.XDocument": "4.0.11-beta-23302"
+ },
+ "frameworks": {
+ "dnxcore50": {}
+ }
+} \ 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..fed40be0ba
--- /dev/null
+++ b/tests/src/baseservices/threading/events/ManualResetEvent/ConstructFalse.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..10d571ab0a
--- /dev/null
+++ b/tests/src/baseservices/threading/events/ManualResetEvent/ConstructTrue.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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/project.json b/tests/src/baseservices/threading/events/ManualResetEvent/project.json
new file mode 100644
index 0000000000..c14efc6fd1
--- /dev/null
+++ b/tests/src/baseservices/threading/events/ManualResetEvent/project.json
@@ -0,0 +1,34 @@
+{
+ "dependencies": {
+ "System.Diagnostics.Process": "4.0.0-beta-23302",
+ "System.IO": "4.0.10-beta-23302",
+ "System.IO.FileSystem": "4.0.0-beta-23302",
+ "System.IO.FileSystem.Primitives": "4.0.0-beta-23302",
+ "System.Runtime": "4.0.20-beta-23302",
+ "System.Runtime.Extensions": "4.0.10-beta-23302",
+ "System.Runtime.Handles": "4.0.0-beta-23302",
+ "System.Runtime.Loader": "4.0.0-beta-23302",
+ "System.Threading": "4.0.10-beta-23302",
+ "System.Threading.AccessControl": "4.0.0-rc3-23823",
+ "System.Globalization.Calendars": "4.0.0-beta-23302",
+ "System.Globalization": "4.0.10-beta-23302",
+ "System.Text.Encoding": "4.0.10-beta-23302",
+ "System.Runtime.InteropServices": "4.0.20-beta-23302",
+ "System.Collections": "4.0.10-beta-23302",
+ "System.Console": "4.0.0-beta-23302",
+ "System.Reflection": "4.0.10-beta-23302",
+ "System.Reflection.Primitives": "4.0.0-beta-23302",
+ "System.ComponentModel": "4.0.1-beta-23302",
+ "System.Xml.ReaderWriter": "4.0.11-beta-23302",
+ "System.Collections.NonGeneric": "4.0.1-beta-23302",
+ "System.Collections.Specialized": "4.0.1-beta-23302",
+ "System.Linq": "4.0.1-beta-23302",
+ "System.Linq.Queryable": "4.0.1-beta-23302",
+ "System.Xml.XmlSerializer": "4.0.11-beta-23302",
+ "System.Xml.XmlDocument": "4.0.1-beta-23302",
+ "System.Xml.XDocument": "4.0.11-beta-23302"
+ },
+ "frameworks": {
+ "dnxcore50": {}
+ }
+} \ 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..a6860c1a33
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit01.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..1a7b217dbe
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit02.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..5699abf5c9
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit03.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..2d85a6a1e5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit04.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..40bacb85aa
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit05.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..e9bcd1c440
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit06.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..0451e197ea
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit07.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..dc97dd5e79
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit08.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..76cfefb843
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit09.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..03b39ce6b0
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit10.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..50f2f8372f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit11.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..a61eca375d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit12.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..a0c591e09f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit13.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..a5056cfa00
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/EnterExit14.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..c0c3c76d02
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter01.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..b2df2424e6
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter03.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..198b8dd96f
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter04.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..c0fd1505a5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter05.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..ff18c48bf2
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/TryEnter06.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>{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>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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/project.json b/tests/src/baseservices/threading/generics/Monitor/project.json
new file mode 100644
index 0000000000..c14efc6fd1
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/Monitor/project.json
@@ -0,0 +1,34 @@
+{
+ "dependencies": {
+ "System.Diagnostics.Process": "4.0.0-beta-23302",
+ "System.IO": "4.0.10-beta-23302",
+ "System.IO.FileSystem": "4.0.0-beta-23302",
+ "System.IO.FileSystem.Primitives": "4.0.0-beta-23302",
+ "System.Runtime": "4.0.20-beta-23302",
+ "System.Runtime.Extensions": "4.0.10-beta-23302",
+ "System.Runtime.Handles": "4.0.0-beta-23302",
+ "System.Runtime.Loader": "4.0.0-beta-23302",
+ "System.Threading": "4.0.10-beta-23302",
+ "System.Threading.AccessControl": "4.0.0-rc3-23823",
+ "System.Globalization.Calendars": "4.0.0-beta-23302",
+ "System.Globalization": "4.0.10-beta-23302",
+ "System.Text.Encoding": "4.0.10-beta-23302",
+ "System.Runtime.InteropServices": "4.0.20-beta-23302",
+ "System.Collections": "4.0.10-beta-23302",
+ "System.Console": "4.0.0-beta-23302",
+ "System.Reflection": "4.0.10-beta-23302",
+ "System.Reflection.Primitives": "4.0.0-beta-23302",
+ "System.ComponentModel": "4.0.1-beta-23302",
+ "System.Xml.ReaderWriter": "4.0.11-beta-23302",
+ "System.Collections.NonGeneric": "4.0.1-beta-23302",
+ "System.Collections.Specialized": "4.0.1-beta-23302",
+ "System.Linq": "4.0.1-beta-23302",
+ "System.Linq.Queryable": "4.0.1-beta-23302",
+ "System.Xml.XmlSerializer": "4.0.11-beta-23302",
+ "System.Xml.XmlDocument": "4.0.1-beta-23302",
+ "System.Xml.XDocument": "4.0.11-beta-23302"
+ },
+ "frameworks": {
+ "dnxcore50": {}
+ }
+} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/generics/TimerCallback/project.json b/tests/src/baseservices/threading/generics/TimerCallback/project.json
new file mode 100644
index 0000000000..864cd20ce2
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/project.json
@@ -0,0 +1,35 @@
+{
+ "dependencies": {
+ "System.Diagnostics.Process": "4.0.0-beta-23302",
+ "System.IO": "4.0.10-beta-23302",
+ "System.IO.FileSystem": "4.0.0-beta-23302",
+ "System.IO.FileSystem.Primitives": "4.0.0-beta-23302",
+ "System.Runtime": "4.0.20-beta-23302",
+ "System.Runtime.Extensions": "4.0.10-beta-23302",
+ "System.Runtime.Handles": "4.0.0-beta-23302",
+ "System.Runtime.Loader": "4.0.0-beta-23302",
+ "System.Threading": "4.0.10-beta-23302",
+ "System.Threading.Timer": "4.0.0-rc3-23823",
+ "System.Threading.AccessControl": "4.0.0-rc3-23823",
+ "System.Globalization.Calendars": "4.0.0-beta-23302",
+ "System.Globalization": "4.0.10-beta-23302",
+ "System.Text.Encoding": "4.0.10-beta-23302",
+ "System.Runtime.InteropServices": "4.0.20-beta-23302",
+ "System.Collections": "4.0.10-beta-23302",
+ "System.Console": "4.0.0-beta-23302",
+ "System.Reflection": "4.0.10-beta-23302",
+ "System.Reflection.Primitives": "4.0.0-beta-23302",
+ "System.ComponentModel": "4.0.1-beta-23302",
+ "System.Xml.ReaderWriter": "4.0.11-beta-23302",
+ "System.Collections.NonGeneric": "4.0.1-beta-23302",
+ "System.Collections.Specialized": "4.0.1-beta-23302",
+ "System.Linq": "4.0.1-beta-23302",
+ "System.Linq.Queryable": "4.0.1-beta-23302",
+ "System.Xml.XmlSerializer": "4.0.11-beta-23302",
+ "System.Xml.XmlDocument": "4.0.1-beta-23302",
+ "System.Xml.XDocument": "4.0.11-beta-23302"
+ },
+ "frameworks": {
+ "dnxcore50": {}
+ }
+} \ 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..7218e1937b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread01.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="thread01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..79b738c45d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread02.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="thread02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..221f9b47f9
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread03.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="thread03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..24692adc0e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread04.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="thread04.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..1af3cbd0a5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread05.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="thread05.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..45d62cfed6
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread06.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="thread06.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..18207e5eee
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread07.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="thread07.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..7b83defc1a
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread08.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="thread08.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..3fd946a976
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread09.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="thread09.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..207c6db0a5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread10.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="thread10.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..7d923b693c
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread11.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="thread11.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..2ede131c91
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread12.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="thread12.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..0168e77c12
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread13.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="thread13.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..74f3301e5d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread14.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="thread14.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..3e9cd3de50
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread15.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="thread15.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..f42003b1ba
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread16.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="thread16.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..eb6593529d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread17.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="thread17.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..9c0060e74b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread18.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="thread18.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..8481ed2366
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread19.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="thread19.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..c82f5871f6
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread20.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="thread20.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..7faae52269
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread21.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="thread21.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..e3c8549fa3
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread22.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="thread22.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..96c4871411
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread23.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="thread23.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..02def7567b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread24.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="thread24.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..bd8de9dd60
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread25.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="thread25.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..b9ccb551ce
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread26.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="thread26.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..166e7b6415
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread27.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="thread27.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..d63ca09367
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread28.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="thread28.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..34dbf491b2
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread29.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="thread29.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..006385d800
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/thread30.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="thread30.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..41b9f99edb
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/TimerCallback/tighttimercallback.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="tighttimercallback.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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/project.json b/tests/src/baseservices/threading/generics/WaitCallback/project.json
new file mode 100644
index 0000000000..c14efc6fd1
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/project.json
@@ -0,0 +1,34 @@
+{
+ "dependencies": {
+ "System.Diagnostics.Process": "4.0.0-beta-23302",
+ "System.IO": "4.0.10-beta-23302",
+ "System.IO.FileSystem": "4.0.0-beta-23302",
+ "System.IO.FileSystem.Primitives": "4.0.0-beta-23302",
+ "System.Runtime": "4.0.20-beta-23302",
+ "System.Runtime.Extensions": "4.0.10-beta-23302",
+ "System.Runtime.Handles": "4.0.0-beta-23302",
+ "System.Runtime.Loader": "4.0.0-beta-23302",
+ "System.Threading": "4.0.10-beta-23302",
+ "System.Threading.AccessControl": "4.0.0-rc3-23823",
+ "System.Globalization.Calendars": "4.0.0-beta-23302",
+ "System.Globalization": "4.0.10-beta-23302",
+ "System.Text.Encoding": "4.0.10-beta-23302",
+ "System.Runtime.InteropServices": "4.0.20-beta-23302",
+ "System.Collections": "4.0.10-beta-23302",
+ "System.Console": "4.0.0-beta-23302",
+ "System.Reflection": "4.0.10-beta-23302",
+ "System.Reflection.Primitives": "4.0.0-beta-23302",
+ "System.ComponentModel": "4.0.1-beta-23302",
+ "System.Xml.ReaderWriter": "4.0.11-beta-23302",
+ "System.Collections.NonGeneric": "4.0.1-beta-23302",
+ "System.Collections.Specialized": "4.0.1-beta-23302",
+ "System.Linq": "4.0.1-beta-23302",
+ "System.Linq.Queryable": "4.0.1-beta-23302",
+ "System.Xml.XmlSerializer": "4.0.11-beta-23302",
+ "System.Xml.XmlDocument": "4.0.1-beta-23302",
+ "System.Xml.XDocument": "4.0.11-beta-23302"
+ },
+ "frameworks": {
+ "dnxcore50": {}
+ }
+} \ 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..7218e1937b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread01.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="thread01.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..79b738c45d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread02.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="thread02.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..221f9b47f9
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread03.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="thread03.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..24692adc0e
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread04.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="thread04.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..1af3cbd0a5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread05.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="thread05.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..45d62cfed6
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread06.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="thread06.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..18207e5eee
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread07.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="thread07.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..7b83defc1a
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread08.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="thread08.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..3fd946a976
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread09.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="thread09.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..207c6db0a5
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread10.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="thread10.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..7d923b693c
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread11.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="thread11.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..2ede131c91
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread12.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="thread12.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..0168e77c12
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread13.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="thread13.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..74f3301e5d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread14.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="thread14.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..3e9cd3de50
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread15.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="thread15.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..f42003b1ba
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread16.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="thread16.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..eb6593529d
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread17.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="thread17.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..9c0060e74b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread18.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="thread18.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..8481ed2366
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread19.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="thread19.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..c82f5871f6
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread20.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="thread20.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..7faae52269
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread21.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="thread21.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..e3c8549fa3
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread22.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="thread22.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..96c4871411
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread23.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="thread23.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..02def7567b
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread24.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="thread24.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..bd8de9dd60
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread25.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="thread25.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..b9ccb551ce
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread26.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="thread26.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..166e7b6415
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread27.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="thread27.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..d63ca09367
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread28.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="thread28.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..34dbf491b2
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread29.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="thread29.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::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..006385d800
--- /dev/null
+++ b/tests/src/baseservices/threading/generics/WaitCallback/thread30.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="thread30.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/testsUnsupportedOutsideWindows.txt b/tests/testsUnsupportedOutsideWindows.txt
index ffb832c2d2..76be20d5b2 100644
--- a/tests/testsUnsupportedOutsideWindows.txt
+++ b/tests/testsUnsupportedOutsideWindows.txt
@@ -1,3 +1,4 @@
+baseservices/threading/commitstackonlyasneeded/DefaultStackCommit/DefaultStackCommit.sh
CoreMangLib/cti/system/byte/ByteToString3/ByteToString3.sh
CoreMangLib/cti/system/convert/ConvertToInt32_4/ConvertToInt32_4.sh
CoreMangLib/cti/system/datetime/DateTimeParseExact1/DateTimeParseExact1.sh