summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAditya Mandaleeka <adityam@microsoft.com>2016-03-18 11:16:45 -0700
committerAditya Mandaleeka <adityam@microsoft.com>2016-03-19 20:56:25 -0700
commit01f3e98f6bf8e356ffb58e2a3ee8a5d6eed177b6 (patch)
tree9e5ba7d560b278f1b119cdc7c0b055617984dd9b /tests
parent7d40932dd7b9141ee0312bc267fa2d50d2b134ac (diff)
downloadcoreclr-01f3e98f6bf8e356ffb58e2a3ee8a5d6eed177b6.tar.gz
coreclr-01f3e98f6bf8e356ffb58e2a3ee8a5d6eed177b6.tar.bz2
coreclr-01f3e98f6bf8e356ffb58e2a3ee8a5d6eed177b6.zip
Delete tests that rely on Thread Abort functionality
Diffstat (limited to 'tests')
-rw-r--r--tests/src/baseservices/threading/monitor/pulse/monitorpulse02.cs55
-rw-r--r--tests/src/baseservices/threading/monitor/pulse/monitorpulse02.csproj41
-rw-r--r--tests/src/baseservices/threading/monitor/tryenter/negativetest.cs104
-rw-r--r--tests/src/baseservices/threading/monitor/tryenter/negativetestharness.csproj41
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am09threadabort.cs71
-rw-r--r--tests/src/baseservices/threading/mutex/abandonedmutex/am09threadabort.csproj42
-rw-r--r--tests/src/baseservices/threading/regressions/135972/app.config31
-rw-r--r--tests/src/baseservices/threading/regressions/135972/oswaitinlock.cs70
-rw-r--r--tests/src/baseservices/threading/regressions/135972/oswaitinlock.csproj42
-rw-r--r--tests/src/baseservices/threading/regressions/135972/oswaitinsleep.cs68
-rw-r--r--tests/src/baseservices/threading/regressions/135972/oswaitinsleep.csproj42
-rw-r--r--tests/src/baseservices/threading/regressions/135972/project.json35
-rw-r--r--tests/src/baseservices/threading/regressions/beta1/322338.cs111
-rw-r--r--tests/src/baseservices/threading/regressions/beta1/322338.csproj43
-rw-r--r--tests/src/baseservices/threading/regressions/beta2/417296_abort.cs102
-rw-r--r--tests/src/baseservices/threading/regressions/beta2/417296_abort.csproj42
-rw-r--r--tests/src/baseservices/threading/regressions/m2/91848.cs78
-rw-r--r--tests/src/baseservices/threading/regressions/m2/91848.csproj42
-rw-r--r--tests/src/baseservices/threading/regressions/m2/app.config31
-rw-r--r--tests/src/baseservices/threading/regressions/m2/project.json35
-rw-r--r--tests/src/baseservices/threading/regressions/m2/tastaticconst.cs70
-rw-r--r--tests/src/baseservices/threading/regressions/m2/tastaticconst.csproj42
-rw-r--r--tests/src/baseservices/threading/regressions/whidbey_m3/105019.cs57
-rw-r--r--tests/src/baseservices/threading/regressions/whidbey_m3/105019.csproj43
-rw-r--r--tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/app.config31
-rw-r--r--tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/project.json35
-rw-r--r--tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/threadabort.cs248
-rw-r--r--tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/threadabort.csproj41
28 files changed, 0 insertions, 1693 deletions
diff --git a/tests/src/baseservices/threading/monitor/pulse/monitorpulse02.cs b/tests/src/baseservices/threading/monitor/pulse/monitorpulse02.cs
deleted file mode 100644
index b8d8a86d50..0000000000
--- a/tests/src/baseservices/threading/monitor/pulse/monitorpulse02.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Reflection;
-using System.Threading;
-
-class Account
-{
- public static void ThreadAbort(Thread thread)
- {
- MethodInfo abort = null;
- foreach(MethodInfo m in thread.GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Instance))
- {
- if (m.Name.Equals("AbortInternal") && m.GetParameters().Length == 0) abort = m;
- }
- if (abort == null)
- {
- throw new Exception("Failed to get Thread.Abort method");
- }
- abort.Invoke(thread, new object[0]);
- }
-
- private int balance = 0;
- public void Deposit()
- {
- lock (this)
- {
- try { Monitor.Wait(this); }
- catch(SynchronizationLockException) { }
- finally { balance += 100; }
- }
- }
- public static int Main()
- {
- int ret = 0;
- Account a = new Account();
- Thread t = new Thread(new ThreadStart(a.Deposit));
- t.Start();
- Thread.Sleep(100);
- lock (a)
- {
- Console.WriteLine(a.balance); // Output: 0
- Monitor.Pulse(a);
- ThreadAbort(t);
- Thread.Sleep(100);
- if(a.balance == 0)
- ret = 100;
- Console.WriteLine(a.balance); // Output: 100.00 (bug)
- }
- Console.WriteLine(100 == ret ? "Test Passed" : "Test Failed");
- return ret;
- }
-} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/monitor/pulse/monitorpulse02.csproj b/tests/src/baseservices/threading/monitor/pulse/monitorpulse02.csproj
deleted file mode 100644
index 7c470fbf4a..0000000000
--- a/tests/src/baseservices/threading/monitor/pulse/monitorpulse02.csproj
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <!-- Add Compile Object Here -->
- <Compile Include="MonitorPulse02.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- <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/monitor/tryenter/negativetest.cs b/tests/src/baseservices/threading/monitor/tryenter/negativetest.cs
deleted file mode 100644
index 2b1b3c344e..0000000000
--- a/tests/src/baseservices/threading/monitor/tryenter/negativetest.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Reflection;
-using System.Threading;
-
-
-public class OutOfRange
-{
- Object lockMe;
- Thread lockHolderThread;
- AutoResetEvent inLock;
-
- public static void ThreadAbort(Thread thread)
- {
- MethodInfo abort = null;
- foreach(MethodInfo m in thread.GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Instance))
- {
- if (m.Name.Equals("AbortInternal") && m.GetParameters().Length == 0) abort = m;
- }
- if (abort == null)
- {
- throw new Exception("Failed to get Thread.Abort method");
- }
- abort.Invoke(thread, new object[0]);
- }
-
- public OutOfRange(){
- lockMe = new Object();
- inLock = new AutoResetEvent(false);
- }
-
- public static int Main(string[] args)
- {
- OutOfRange oor = new OutOfRange();
- int ret = oor.RunNegative(1);
- ret += oor.RunNegative(2);
- Console.WriteLine(ret/2 == 100 ? "Test Passed":"Test Failed");
- return ret/2;
- }
-
-
- public int RunNegative(int test)
- {
- Console.WriteLine("Running Negative Test "+test);
- int rValue = 0;
- TimeSpan ts;
-
- switch(test){
- case 1:
- Console.WriteLine("Int32.MaxValue + 1");
- ts = new TimeSpan(21474836480000);
- try{
- Monitor.TryEnter(lockMe,ts);
- }
- catch(ArgumentOutOfRangeException)
- {
- rValue = 100;
- }
- break;
-
- case 2:
- Console.WriteLine("TimeSpan(-2)");
- ts = new TimeSpan(-20000);
- Console.WriteLine(ts.TotalMilliseconds);
- NewThreadHoldLock();
- try{
- Monitor.TryEnter(lockMe,ts);
- }
- catch(ArgumentOutOfRangeException)
- {
- rValue = 100;
- }
- AbortLockHolderThread();
- break;
-
- }
- return rValue;
- }
-
- private void AbortLockHolderThread()
- {
- ThreadAbort(lockHolderThread);
- }
-
- private void NewThreadHoldLock()
- {
- lockHolderThread = new Thread(new ParameterizedThreadStart(HoldLock));
- lockHolderThread.Start(lockMe);
- inLock.WaitOne();
-
- }
- private void HoldLock(object foo)
- {
- lock(foo)
- {
- inLock.Set();
- Thread.Sleep(-1);
- }
- }
-}
-
diff --git a/tests/src/baseservices/threading/monitor/tryenter/negativetestharness.csproj b/tests/src/baseservices/threading/monitor/tryenter/negativetestharness.csproj
deleted file mode 100644
index 56c4e20daf..0000000000
--- a/tests/src/baseservices/threading/monitor/tryenter/negativetestharness.csproj
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <!-- Add Compile Object Here -->
- <Compile Include="NegativeTest.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- <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/mutex/abandonedmutex/am09threadabort.cs b/tests/src/baseservices/threading/mutex/abandonedmutex/am09threadabort.cs
deleted file mode 100644
index a8ba27b35d..0000000000
--- a/tests/src/baseservices/threading/mutex/abandonedmutex/am09threadabort.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Reflection;
-using System.Threading;
-
-class WaitAllEx
-{
- private Mutex myMutex01 = new Mutex(false, Common.GetUniqueName());
- private Mutex myMutex02 = new Mutex(false, Common.GetUniqueName());
- private Mutex myMutex03 = new Mutex(false, Common.GetUniqueName());
- private ManualResetEvent myMRE = new ManualResetEvent(false);
- private int iRet = -1;
-
- private static void ThreadAbort(Thread thread)
- {
- MethodInfo abort = null;
- foreach(MethodInfo m in thread.GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Instance))
- {
- if (m.Name.Equals("AbortInternal") && m.GetParameters().Length == 0) abort = m;
- }
- if (abort == null)
- {
- throw new Exception("Failed to get Thread.Abort method");
- }
- abort.Invoke(thread, new object[0]);
- }
-
- public static int Main()
- {
- WaitAllEx wae = new WaitAllEx();
- wae.Run();
- Console.WriteLine(wae.iRet == 100 ? "Test Passed!" : "Test Failed");
- return wae.iRet;
- }
-
- private void Run()
- {
- Thread t = new Thread(new ThreadStart(this.AbandonTheMutex));
- t.Start();
- myMRE.WaitOne();
- Thread.Sleep(500);
- ThreadAbort(t);
-
- try
- {
- Console.WriteLine("Waiting...");
- int ret = WaitHandle.WaitAny(
- new WaitHandle[]{myMutex01, myMutex02, myMutex03}, 5000);
- Console.WriteLine("WaitAll did not throw an " +
- "exception, return = " + ret);
- }
- catch(AbandonedMutexException am)
- {
- Console.WriteLine("AbandonedMutexException thrown! Checking values...");
- if(0 == am.MutexIndex && myMutex01 == am.Mutex)
- iRet = 100;
- }
- }
-
- private void AbandonTheMutex()
- {
- myMutex01.WaitOne();
- myMutex02.WaitOne();
- myMutex03.WaitOne();
- myMRE.Set();
- Thread.Sleep(10000);
- }
-}
diff --git a/tests/src/baseservices/threading/mutex/abandonedmutex/am09threadabort.csproj b/tests/src/baseservices/threading/mutex/abandonedmutex/am09threadabort.csproj
deleted file mode 100644
index 60f716f530..0000000000
--- a/tests/src/baseservices/threading/mutex/abandonedmutex/am09threadabort.csproj
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <!-- Add Compile Object Here -->
- <Compile Include="AM09ThreadAbort.cs" />
- <Compile Include="..\OpenMutexCommon.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- <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/regressions/135972/app.config b/tests/src/baseservices/threading/regressions/135972/app.config
deleted file mode 100644
index c51f616257..0000000000
--- a/tests/src/baseservices/threading/regressions/135972/app.config
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
- <runtime>
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
- <dependentAssembly>
- <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Globalization" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- </assemblyBinding>
- </runtime>
-</configuration>
diff --git a/tests/src/baseservices/threading/regressions/135972/oswaitinlock.cs b/tests/src/baseservices/threading/regressions/135972/oswaitinlock.cs
deleted file mode 100644
index ae9b4dcea0..0000000000
--- a/tests/src/baseservices/threading/regressions/135972/oswaitinlock.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Threading;
-
-public class Bug
-{
- public static int Main()
- {
- Console.WriteLine("Repro for Bug 135972");
- TestCase bugCheck = new TestCase();
- return bugCheck.Run();
- }
-}
-
-public class TestCase
-{
- private int ret;
- private Object mylock;
- private AutoResetEvent are;
-
- public TestCase()
- {
- mylock = new Object();
- are = new AutoResetEvent(false);
- }
-
- public int Run()
- {
- lock(mylock)
- {
- ret = 0;
- Thread t;
- t = new Thread(new ThreadStart(BlockThreadOnWait));
- t.Start();
- Thread.Sleep(3000);
- Console.WriteLine("Signaling");
- are.Set();
- Thread.Sleep(1000);
- Console.WriteLine("Main Waiting");
- Thread.Sleep(1000);
- Console.WriteLine("Aborting New Thread");
- ThreadEx.Abort(t);
- t.Join();
- }
- return ret;
-
- }
-
- public void BlockThreadOnWait()
- {
- try{
- Console.WriteLine("New Thread Waiting");
- are.WaitOne();
- Console.WriteLine("New Thread Signaled");
- lock(mylock){
- //This line will never print since the lock is held by thread 1
- //Need this here so the jit doesn't optimize this lock away
- ret = -1;
- Console.WriteLine("In The Lock Sleep");
- }
- }
- catch(Exception)
- {
- Interlocked.CompareExchange(ref ret,100,0);
- }
- }
-}
diff --git a/tests/src/baseservices/threading/regressions/135972/oswaitinlock.csproj b/tests/src/baseservices/threading/regressions/135972/oswaitinlock.csproj
deleted file mode 100644
index 6b5bbb2062..0000000000
--- a/tests/src/baseservices/threading/regressions/135972/oswaitinlock.csproj
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <!-- Add Compile Object Here -->
- <Compile Include="OSWaitInLock.cs" />
- <Compile Include="..\threadex.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- <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/regressions/135972/oswaitinsleep.cs b/tests/src/baseservices/threading/regressions/135972/oswaitinsleep.cs
deleted file mode 100644
index 7ef2bfa4c4..0000000000
--- a/tests/src/baseservices/threading/regressions/135972/oswaitinsleep.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Threading;
-
-public class Bug
-{
- public static int Main()
- {
- Console.WriteLine("Repro for Bug 135972");
- TestCase bugCheck = new TestCase();
- return bugCheck.Run();
- }
-}
-
-public class TestCase
-{
- private int ret;
- private Object mylock;
- private AutoResetEvent are;
-
- public TestCase()
- {
- mylock = new Object();
- are = new AutoResetEvent(false);
- }
-
- public int Run()
- {
- lock(mylock)
- {
- ret = 0;
- Thread t;
- t = new Thread(new ThreadStart(BlockThreadOnWait));
- t.Start();
- Thread.Sleep(3000);
- Console.WriteLine("Signaling");
- are.Set();
- Thread.Sleep(1000);
- Console.WriteLine("Main Waiting");
- Thread.Sleep(1000);
- Console.WriteLine("Aborting New Thread");
- ThreadEx.Abort(t);
- t.Join();
- }
- return ret;
-
- }
-
- public void BlockThreadOnWait()
- {
- try{
- Console.WriteLine("New Thread Waiting");
- are.WaitOne();
- Console.WriteLine("New Thread Signaled");
- Thread.Sleep(Timeout.Infinite);
- //Should never hit this line
- ret = -1;
- Console.WriteLine("In The Lock Sleep");
- }
- catch(Exception)
- {
- Interlocked.CompareExchange(ref ret,100,0);
- }
- }
-}
diff --git a/tests/src/baseservices/threading/regressions/135972/oswaitinsleep.csproj b/tests/src/baseservices/threading/regressions/135972/oswaitinsleep.csproj
deleted file mode 100644
index 8d35d8bee5..0000000000
--- a/tests/src/baseservices/threading/regressions/135972/oswaitinsleep.csproj
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <!-- Add Compile Object Here -->
- <Compile Include="OSWaitInSleep.cs" />
- <Compile Include="..\threadex.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- <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/regressions/135972/project.json b/tests/src/baseservices/threading/regressions/135972/project.json
deleted file mode 100644
index 21a7fa4381..0000000000
--- a/tests/src/baseservices/threading/regressions/135972/project.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "dependencies": {
- "Microsoft.NETCore.Platforms": "1.0.1-rc2-23816",
- "System.Collections": "4.0.10",
- "System.Collections.NonGeneric": "4.0.1-rc2-23816",
- "System.Collections.Specialized": "4.0.1-rc2-23816",
- "System.ComponentModel": "4.0.1-rc2-23816",
- "System.Console": "4.0.0-rc2-23816",
- "System.Diagnostics.Process": "4.1.0-rc2-23816",
- "System.Globalization": "4.0.10",
- "System.Globalization.Calendars": "4.0.0",
- "System.IO": "4.0.10",
- "System.IO.FileSystem": "4.0.0",
- "System.IO.FileSystem.Primitives": "4.0.0",
- "System.Linq": "4.0.1-rc2-23816",
- "System.Linq.Queryable": "4.0.1-rc2-23816",
- "System.Reflection": "4.0.10",
- "System.Reflection.Primitives": "4.0.0",
- "System.Runtime": "4.1.0-rc2-23816",
- "System.Runtime.Extensions": "4.0.10",
- "System.Runtime.Handles": "4.0.0",
- "System.Runtime.InteropServices": "4.1.0-rc2-23816",
- "System.Runtime.Loader": "4.0.0-rc2-23816",
- "System.Text.Encoding": "4.0.10",
- "System.Threading": "4.0.10",
- "System.Threading.Thread": "4.0.0-rc2-23816",
- "System.Xml.ReaderWriter": "4.0.11-rc2-23816",
- "System.Xml.XDocument": "4.0.11-rc2-23816",
- "System.Xml.XmlDocument": "4.0.1-rc2-23816",
- "System.Xml.XmlSerializer": "4.0.11-rc2-23816"
- },
- "frameworks": {
- "dnxcore50": {}
- }
-} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/beta1/322338.cs b/tests/src/baseservices/threading/regressions/beta1/322338.cs
deleted file mode 100644
index 97be8b94ba..0000000000
--- a/tests/src/baseservices/threading/regressions/beta1/322338.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Threading;
-
-public class Test
-{
- public bool FinallyCalled;
- public int RunLength;
- public int SpecificWait;
-
- static public int Main(string[] args)
- {
- if(args.Length < 1)
- {
- Console.WriteLine("Must supply run length");
- return 10;
- }
-
- Test T = new Test();
- T.SpecificWait = 0;
- T.RunLength = Int32.Parse(args[0]);
- if(args.Length == 2)
- {
- T.SpecificWait = Int32.Parse(args[1]);
- }
- int retVal = T.Run();
- Console.WriteLine(100 == retVal ? "Test Passed":"Test Failed");
- return retVal;
- }
-
- public int Run()
- {
- Thread NewThread = null;
- Random RandomWait = new Random();
- int Runs = 0;
-
- FinallyCalled = true;
-
- for (int i = 0; i< RunLength; i++)
- {
- // Create new Thread for test and start it
- NewThread = new Thread( new ThreadStart(TestFinally ) );
- NewThread.Start();
- // Wait random period of time for thread
- int wait;
- if(SpecificWait == 0)
- {
- wait = RandomWait.Next();
- wait = wait % 2000;
- }
- else
- {
- wait = SpecificWait;
- }
-
- Console.WriteLine("Testing with {0}", wait);
- Thread.Sleep( wait );
-
- // Abort thread, and wait to finish
- ThreadEx.Abort(NewThread);
- NewThread.Join();
-
- Console.WriteLine(" Finshed run #{0}", Runs++ );
-
- // Test if finally was called
- if ( FinallyCalled != true )
- {
- Console.WriteLine("FAILURE!!! Finally was not hit, or this would be true");
- return 5;
- }
- }
- return 100;
- }
-
- public void TestFinally()
- {
- try
- {
- // We have set FinallyCalled to false, so if we are aborted this should
- // be set to true no matter what!! (this is the bug)
- FinallyCalled = false;
-
- // Loop until this thread is aborted
- while ( true )
- {
- CallTryTest();
- }
- }
- finally
- {
- // This should be called no matter what
- FinallyCalled = true;
- }
- }
-
- private void CallTryTest()
- {
- try
- {
- // Do Something/Work (this could be anything)
- FinallyCalled = false;
- }
- catch (Exception e)
- {
- Console.WriteLine("Caught exception '{0}'", e.Message );
- }
- }
-} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/beta1/322338.csproj b/tests/src/baseservices/threading/regressions/beta1/322338.csproj
deleted file mode 100644
index 5b6b350d48..0000000000
--- a/tests/src/baseservices/threading/regressions/beta1/322338.csproj
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
- <CLRTestExecutionArguments>240</CLRTestExecutionArguments>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <!-- Add Compile Object Here -->
- <Compile Include="322338.cs" />
- <Compile Include="..\threadex.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- <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/regressions/beta2/417296_abort.cs b/tests/src/baseservices/threading/regressions/beta2/417296_abort.cs
deleted file mode 100644
index 782bfdb73d..0000000000
--- a/tests/src/baseservices/threading/regressions/beta2/417296_abort.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Threading;
-
-/*
- * Test case verifies that when we take a thread abort exception
- * while blocked waiting to re-acquire a monitor after doing a Monitor.Wait
- * that we do not allow the thread to run again until the first thread
- * has released it's lock.
- *
- */
-class Test
-{
- object someLock = new object();
- volatile bool thread1Locked = false, thread2exception = false;
- int success = 100;
-
- static int Main()
- {
- return(new Test().RunTest());
- }
-
- int RunTest()
- {
- Console.WriteLine ("Main thread starting");
- Thread secondThread = new Thread (new ThreadStart(ThreadJob));
- secondThread.Start();
- Console.WriteLine ("Main thread sleeping");
- Thread.Sleep(500);
- lock (someLock)
- {
- thread1Locked = true;
- Console.WriteLine ("Main thread acquired lock - pulsing monitor");
- Monitor.Pulse(someLock);
- Console.WriteLine ("Monitor pulsed; interrupting second thread");
- ThreadEx.Abort(secondThread);
- Thread.Sleep(1000);
- Console.WriteLine ("Main thread still owns lock...");
- Thread.Sleep(2000);
- Console.WriteLine ("Main thread still owns lock...");
- thread1Locked = false;
- if(thread2exception)
- {
- Console.WriteLine("Thread2 took exception too early");
- success = 95;
- }
- }
- secondThread.Join();
- if(success == 100)
- {
- Console.WriteLine("Test passed");
- }
- else
- {
- Console.WriteLine("Test failed");
- }
- return(success);
- }
-
- void ThreadJob()
- {
- Console.WriteLine ("Second thread starting");
-
- lock (someLock)
- {
- Console.WriteLine ("Second thread acquired lock - about to wait");
- try
- {
- Monitor.Wait(someLock);
- }
- catch (Exception e)
- {
- thread2exception = true;
- if(thread1Locked)
- {
- success = 98;
- }
- Console.WriteLine ("Second thread caught an exception: {0}", e);
- if(Monitor.TryEnter(someLock))
- {
- Console.WriteLine("Thread2 holds the lock");
- Monitor.Exit(someLock);
- }
- else
- {
- Console.WriteLine("Couldn't recurse on lock");
- success = 97;
- }
-
- if(!(e.GetType().ToString().Equals("System.Threading.ThreadAbortException")))
- {
- Console.WriteLine("Wrong exception: {0}",e);
- success = 92;
- }
- }
- }
- }
-}
-
diff --git a/tests/src/baseservices/threading/regressions/beta2/417296_abort.csproj b/tests/src/baseservices/threading/regressions/beta2/417296_abort.csproj
deleted file mode 100644
index 7f8f904aae..0000000000
--- a/tests/src/baseservices/threading/regressions/beta2/417296_abort.csproj
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <!-- Add Compile Object Here -->
- <Compile Include="417296_abort.cs" />
- <Compile Include="..\threadex.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- <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/regressions/m2/91848.cs b/tests/src/baseservices/threading/regressions/m2/91848.cs
deleted file mode 100644
index 9d86e8f601..0000000000
--- a/tests/src/baseservices/threading/regressions/m2/91848.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Threading;
-
-
-public class TestRudeAbort {
-
- public int rValue;
-
- public TestRudeAbort()
- {
- rValue = 0;
- }
-
- public static int Main() {
-
- TestRudeAbort myTest = new TestRudeAbort();
- myTest.ExecuteTest();
- Console.WriteLine("Test {0}",myTest.rValue == 100 ? "paSSed":"failed");
- return myTest.rValue;
-
- }
-
- public void ExecuteTest()
- {
- Thread t = new Thread(new ThreadStart(this.ThrowInStatic));
- t.Start();
- t.Join();
- try{
- //Thread is dead - Try to access Static Method
- // This call should fail since the constructor never ran
- SBad.MyMethod();
- //If we got here, we accessed an unitialized class
- Console.WriteLine("ERRROR -- Accessed the class");
- lock(this) this.rValue = -1;
- SBad.Obj.ToString();
- //If we got here, we accessed an unitialized class
- Console.WriteLine("ERRROR -- Accessed the class");
- lock(this) this.rValue = -2;
- }
- catch(TypeInitializationException){
- //Caught TypeInit Exception as expected
- Interlocked.CompareExchange(ref this.rValue,100,0);
- }
- }
-
- public void ThrowInStatic()
- {
- try{
- SBad.MyMethod();
- }
- catch(TypeInitializationException)
- {
- //This is expected
- }
- Console.WriteLine("ERROR --- This line will never print since the thread aborted()");
- lock(this) this.rValue = -5;
- }
-}
-
-public class SBad
-{
- public static Object Obj = null;
- static SBad(){
- //Console.WriteLine("In the Constructor");
- ThreadEx.Abort(Thread.CurrentThread);
- Console.WriteLine("After Abort");
- Obj = new Object();
- }
-
- public static void MyMethod()
- {
- Console.WriteLine("ERROR --- Should have been type Load");
- }
-} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/m2/91848.csproj b/tests/src/baseservices/threading/regressions/m2/91848.csproj
deleted file mode 100644
index 7cd7501cf3..0000000000
--- a/tests/src/baseservices/threading/regressions/m2/91848.csproj
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <!-- Add Compile Object Here -->
- <Compile Include="91848.cs" />
- <Compile Include="..\threadex.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- <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/regressions/m2/app.config b/tests/src/baseservices/threading/regressions/m2/app.config
deleted file mode 100644
index c51f616257..0000000000
--- a/tests/src/baseservices/threading/regressions/m2/app.config
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
- <runtime>
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
- <dependentAssembly>
- <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Globalization" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- </assemblyBinding>
- </runtime>
-</configuration>
diff --git a/tests/src/baseservices/threading/regressions/m2/project.json b/tests/src/baseservices/threading/regressions/m2/project.json
deleted file mode 100644
index 21a7fa4381..0000000000
--- a/tests/src/baseservices/threading/regressions/m2/project.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "dependencies": {
- "Microsoft.NETCore.Platforms": "1.0.1-rc2-23816",
- "System.Collections": "4.0.10",
- "System.Collections.NonGeneric": "4.0.1-rc2-23816",
- "System.Collections.Specialized": "4.0.1-rc2-23816",
- "System.ComponentModel": "4.0.1-rc2-23816",
- "System.Console": "4.0.0-rc2-23816",
- "System.Diagnostics.Process": "4.1.0-rc2-23816",
- "System.Globalization": "4.0.10",
- "System.Globalization.Calendars": "4.0.0",
- "System.IO": "4.0.10",
- "System.IO.FileSystem": "4.0.0",
- "System.IO.FileSystem.Primitives": "4.0.0",
- "System.Linq": "4.0.1-rc2-23816",
- "System.Linq.Queryable": "4.0.1-rc2-23816",
- "System.Reflection": "4.0.10",
- "System.Reflection.Primitives": "4.0.0",
- "System.Runtime": "4.1.0-rc2-23816",
- "System.Runtime.Extensions": "4.0.10",
- "System.Runtime.Handles": "4.0.0",
- "System.Runtime.InteropServices": "4.1.0-rc2-23816",
- "System.Runtime.Loader": "4.0.0-rc2-23816",
- "System.Text.Encoding": "4.0.10",
- "System.Threading": "4.0.10",
- "System.Threading.Thread": "4.0.0-rc2-23816",
- "System.Xml.ReaderWriter": "4.0.11-rc2-23816",
- "System.Xml.XDocument": "4.0.11-rc2-23816",
- "System.Xml.XmlDocument": "4.0.1-rc2-23816",
- "System.Xml.XmlSerializer": "4.0.11-rc2-23816"
- },
- "frameworks": {
- "dnxcore50": {}
- }
-} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/m2/tastaticconst.cs b/tests/src/baseservices/threading/regressions/m2/tastaticconst.cs
deleted file mode 100644
index df91832f23..0000000000
--- a/tests/src/baseservices/threading/regressions/m2/tastaticconst.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Threading;
-
-
-public class TestRudeAbort {
-
- public int rValue;
-
- public TestRudeAbort(){
-
- rValue = 0;
- }
-
- public static int Main() {
-
- //If Static Constructor Fails to run the struct should not get loaded
-
- TestRudeAbort tra = new TestRudeAbort();
- Thread t = new Thread(new ThreadStart(tra.Run));
- t.Start();
- t.Join();
- try{
- Console.WriteLine("Thread is dead - Accessing Static Method");
- SBad.MyMethod();
- SBad.Obj.ToString();
- }
- catch(TypeInitializationException){
- //Should get a TypeInitializationException since the
- // static constructor never ran.
- //If no failure i.e. rValue == 0 then set return to 100
- Interlocked.CompareExchange(ref tra.rValue,100,0);
- }
- Console.WriteLine("Test {0}",tra.rValue == 100?"Passed":"Failed");
- return tra.rValue;
- }
-
- public void Run()
- {
- try{
- SBad.MyMethod();
- }
- catch(TypeInitializationException)
- {
- //This should never print anything since the thread is Aborted
- this.rValue = -1;
- }
- Console.WriteLine("This line should never print since the thread aborted()");
- this.rValue = -2;
- }
-}
-
-public struct SBad
-{
- public static Object Obj = null;
- static SBad(){
- //Console.WriteLine("In the Constructor");
- ThreadEx.Abort(Thread.CurrentThread);
- Console.WriteLine("After Abort");
- Obj = new Object();
- }
-
- public static void MyMethod()
- {
- Console.WriteLine("Should have been type Load");
- }
-} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/regressions/m2/tastaticconst.csproj b/tests/src/baseservices/threading/regressions/m2/tastaticconst.csproj
deleted file mode 100644
index 71b3f1c163..0000000000
--- a/tests/src/baseservices/threading/regressions/m2/tastaticconst.csproj
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <!-- Add Compile Object Here -->
- <Compile Include="TAStaticConst.cs" />
- <Compile Include="..\threadex.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- <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/regressions/whidbey_m3/105019.cs b/tests/src/baseservices/threading/regressions/whidbey_m3/105019.cs
deleted file mode 100644
index 301176162f..0000000000
--- a/tests/src/baseservices/threading/regressions/whidbey_m3/105019.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Threading;
-
-public class Stop
-{
-
- int av;
- AutoResetEvent are = new AutoResetEvent(false);
-
- unsafe public void T1Start()
- {
- are.Set();
- for (; ; )
- {
- try
- {
- int* p = null;
- *p = 1;
- }
- catch
- {
- av++;
- }
- }
- }
-
- public static int Main(String[] args)
- {
- Stop tm = new Stop();
- Thread t = new Thread(new ThreadStart(tm.RunTest));
- t.Start();
- //Sleep for 3 minutes
- Thread.Sleep(3 * 60 * 1000);
- ThreadEx.Abort(t);
- return 100;
-
- }
- public void RunTest()
- {
- ThreadStart ts = new ThreadStart(this.T1Start);
- for (; ; )
- {
- Thread t1 = new Thread(ts);
- t1.IsBackground = true;
- t1.Start();
- are.WaitOne();
- Console.WriteLine("Aborting t1 " + this.av);
- ThreadEx.Abort(t1);
- Console.WriteLine("Aborted");
- }
-
- }
-}
diff --git a/tests/src/baseservices/threading/regressions/whidbey_m3/105019.csproj b/tests/src/baseservices/threading/regressions/whidbey_m3/105019.csproj
deleted file mode 100644
index 217807c804..0000000000
--- a/tests/src/baseservices/threading/regressions/whidbey_m3/105019.csproj
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <!-- Add Compile Object Here -->
- <Compile Include="105019.cs" />
- <Compile Include="..\threadex.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- <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/waithandle/abandonedmutexscenarios/app.config b/tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/app.config
deleted file mode 100644
index c51f616257..0000000000
--- a/tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/app.config
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
- <runtime>
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
- <dependentAssembly>
- <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Globalization" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
- </dependentAssembly>
- </assemblyBinding>
- </runtime>
-</configuration>
diff --git a/tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/project.json b/tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/project.json
deleted file mode 100644
index 21a7fa4381..0000000000
--- a/tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/project.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "dependencies": {
- "Microsoft.NETCore.Platforms": "1.0.1-rc2-23816",
- "System.Collections": "4.0.10",
- "System.Collections.NonGeneric": "4.0.1-rc2-23816",
- "System.Collections.Specialized": "4.0.1-rc2-23816",
- "System.ComponentModel": "4.0.1-rc2-23816",
- "System.Console": "4.0.0-rc2-23816",
- "System.Diagnostics.Process": "4.1.0-rc2-23816",
- "System.Globalization": "4.0.10",
- "System.Globalization.Calendars": "4.0.0",
- "System.IO": "4.0.10",
- "System.IO.FileSystem": "4.0.0",
- "System.IO.FileSystem.Primitives": "4.0.0",
- "System.Linq": "4.0.1-rc2-23816",
- "System.Linq.Queryable": "4.0.1-rc2-23816",
- "System.Reflection": "4.0.10",
- "System.Reflection.Primitives": "4.0.0",
- "System.Runtime": "4.1.0-rc2-23816",
- "System.Runtime.Extensions": "4.0.10",
- "System.Runtime.Handles": "4.0.0",
- "System.Runtime.InteropServices": "4.1.0-rc2-23816",
- "System.Runtime.Loader": "4.0.0-rc2-23816",
- "System.Text.Encoding": "4.0.10",
- "System.Threading": "4.0.10",
- "System.Threading.Thread": "4.0.0-rc2-23816",
- "System.Xml.ReaderWriter": "4.0.11-rc2-23816",
- "System.Xml.XDocument": "4.0.11-rc2-23816",
- "System.Xml.XmlDocument": "4.0.1-rc2-23816",
- "System.Xml.XmlSerializer": "4.0.11-rc2-23816"
- },
- "frameworks": {
- "dnxcore50": {}
- }
-} \ No newline at end of file
diff --git a/tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/threadabort.cs b/tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/threadabort.cs
deleted file mode 100644
index c1c44dd2b1..0000000000
--- a/tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/threadabort.cs
+++ /dev/null
@@ -1,248 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Reflection;
-using System.Threading;
-
-class WaitOneEx
-{
- private Mutex myMutex;
- private AutoResetEvent myARE;
- int successes;
- int failures;
- int expected;
-
- public WaitOneEx()
- {
- myMutex = new Mutex(false, "myMutex");
- myARE = new AutoResetEvent(true);
- successes = 0;
- failures = 0;
- expected = 3;
- }
-
- public static int Main()
- {
- WaitOneEx wao = new WaitOneEx();
- wao.TestOne();
- wao.TestTwo();
- wao.TestThree();
- return wao.CheckSuccess();
- }
-
- // This test ensures that an AbandonedMutexException is thrown when
- // the thread is aborted and the mutex abandoned.
- private void TestOne()
- {
- Console.WriteLine("MT: Test One");
- // First thread abandon's the mutex by doing a thread.abort
- Thread t = new Thread(new ThreadStart(this.AbandonTheMutex));
- t.Start();
- // Second thread catches the exception
- bool bRet = false;
-
- myARE.Set();
- Thread.Sleep(500);
- ThreadAbort(t);
- try
- {
- Console.WriteLine("MT: Wait on an abandoned mutex");
- bRet = myMutex.WaitOne();
- }
- catch(AbandonedMutexException)
- {
- // Expected
- Console.WriteLine("MT PASS: AbandonedMutexException thrown!");
- Success();
- // Release the Mutex
- myMutex.ReleaseMutex();
- return;
- }
- catch(Exception e)
- {
- Failure("MT FAIL: Unexpected exception thrown: " +
- e.ToString());
- myMutex.ReleaseMutex();
- return;
- }
- Failure("MT FAIL: Test did not throw AbandonedMutexException");
- // Release the Mutex
- myMutex.ReleaseMutex();
- }
-
- // This test ensures that releasing a Mutex in the catch works and
- // does not throw an AbandonedMutexException
- private void TestTwo()
- {
- Console.WriteLine("Test Two");
- // First thread abandon's the mutex by doing a thread.abort
- Thread t = new Thread(new ThreadStart(this.ReleaseInCatch));
- t.Start();
- // Second thread catches the exception
- bool bRet = false;
-
- myARE.Set();
- Thread.Sleep(500);
- ThreadAbort(t);
- try
- {
- Console.WriteLine("Wait on an abandoned mutex");
- bRet = myMutex.WaitOne();
- }
- catch(AbandonedMutexException)
- {
- // Not Expected
- Failure("MT FAIL: Test threw an AbandonedMutexException!");
- // Release the Mutex
- myMutex.ReleaseMutex();
- return;
- }
- catch(Exception e)
- {
- Failure("MT FAIL: Unexpected exception thrown: " +
- e.ToString());
- myMutex.ReleaseMutex();
- return;
- }
- Console.WriteLine("MT PASS: No exception thrown!");
- Success();
- // Release the Mutex
- myMutex.ReleaseMutex();
- }
-
- // This test ensures that releasing a Mutex in the finally works and
- // does not throw an AbandonedMutexException
- private void TestThree()
- {
- Console.WriteLine("Test Three");
- // First thread abandon's the mutex by doing a thread.abort
- Thread t = new Thread(new ThreadStart(this.ReleaseInFinally));
- t.Start();
- // Second thread catches the exception
- bool bRet = false;
-
- myARE.Set();
- Thread.Sleep(500);
- ThreadAbort(t);
- try
- {
- Console.WriteLine("Wait on an abandoned mutex");
- bRet = myMutex.WaitOne();
- }
- catch(AbandonedMutexException)
- {
- // Not Expected
- Failure("MT FAIL: Test threw an AbandonedMutexException!");
- // Release the Mutex
- myMutex.ReleaseMutex();
- return;
- }
- catch(Exception e)
- {
- Failure("MT FAIL: Unexpected exception thrown: " +
- e.ToString());
- myMutex.ReleaseMutex();
- return;
- }
- Console.WriteLine("MT PASS: No exception thrown!");
- Success();
- // Release the Mutex
- myMutex.ReleaseMutex();
- }
-
- private void AbandonTheMutex()
- {
- Console.WriteLine("ATM: Acquire the Mutex");
- myMutex.WaitOne();
- Console.WriteLine("ATM: Waiting for signal");
- // wait for signal to abort
- myARE.WaitOne();
- try
- {
- Thread.Sleep(10000);
- }
- catch(Exception e)
- {
- Console.WriteLine(e);
- Console.WriteLine("ATM: ThreadAbortException thrown");
- // swallow exception to abandon mutex
- myARE.Reset();
- }
- }
-
- private void ReleaseInCatch()
- {
- Console.WriteLine("RIC: Acquire the Mutex");
- myMutex.WaitOne();
- Console.WriteLine("RIC: Waiting for signal");
- myARE.WaitOne();
- try
- {
- Thread.Sleep(10000);
- }
- catch(Exception e)
- {
- Console.WriteLine(e);
- Console.WriteLine("RIC: ThreadAbortException thrown, releasing mutex");
- myMutex.ReleaseMutex();
- }
- }
-
- private void ReleaseInFinally()
- {
- Console.WriteLine("RIF: Acquire the Mutex");
- myMutex.WaitOne();
- Console.WriteLine("RIF: Waiting for signal");
- myARE.WaitOne();
- try
- {
- Thread.Sleep(10000);
- }
- catch(Exception e)
- {
- Console.WriteLine(e);
- Console.WriteLine("RIF: ThreadAbortException thrown");
- }
- finally
- {
- myMutex.ReleaseMutex();
- }
- }
-
- private int CheckSuccess()
- {
- if(successes == expected && failures == 0)
- {
- Console.WriteLine("**** All tests passed! ****");
- return 100;
- }
- Console.WriteLine("There were one or more failures");
- return -1;
- }
-
- private void Failure(string message)
- {
- Console.WriteLine(message);
- failures++;
- }
-
- private void Success()
- {
- successes++;
- }
-
- private static void ThreadAbort(Thread thread)
- {
- MethodInfo abort = null;
- foreach(MethodInfo m in thread.GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Instance))
- {
- if (m.Name.Equals("AbortInternal") && m.GetParameters().Length == 0) abort = m;
- }
- if (abort == null) {
- throw new Exception("Failed to get Thread.Abort method");
- }
- abort.Invoke(thread, new object[0]);
- }
-}
diff --git a/tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/threadabort.csproj b/tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/threadabort.csproj
deleted file mode 100644
index df652b3fe0..0000000000
--- a/tests/src/baseservices/threading/waithandle/abandonedmutexscenarios/threadabort.csproj
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <!-- Add Compile Object Here -->
- <Compile Include="ThreadAbort.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- <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