Add nullable annotations to System.Threading.Thread ref assembly (dotnet/corefx#38236)
authorSantiago Fernandez Madero <safern@microsoft.com>
Fri, 14 Jun 2019 00:10:11 +0000 (17:10 -0700)
committerStephen Toub <stoub@microsoft.com>
Fri, 14 Jun 2019 00:10:11 +0000 (20:10 -0400)
Commit migrated from https://github.com/dotnet/corefx/commit/44d305e2f0a312bb0506e0e1ef1fcafeb07b2bb1

src/libraries/System.Threading.Thread/ref/System.Threading.Thread.cs
src/libraries/System.Threading.Thread/ref/System.Threading.Thread.csproj

index 86569df..7cc885a 100644 (file)
@@ -28,9 +28,9 @@ namespace System.Threading
         public System.Threading.CompressedStack CreateCopy() { throw null; }
         public static System.Threading.CompressedStack GetCompressedStack() { throw null; }
         public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
-        public static void Run(System.Threading.CompressedStack compressedStack, System.Threading.ContextCallback callback, object state) { }
+        public static void Run(System.Threading.CompressedStack compressedStack, System.Threading.ContextCallback callback, object? state) { }
     }
-    public delegate void ParameterizedThreadStart(object obj);
+    public delegate void ParameterizedThreadStart(object? obj);
     public sealed partial class Thread : System.Runtime.ConstrainedExecution.CriticalFinalizerObject
     {
         public Thread(System.Threading.ParameterizedThreadStart start) { }
@@ -40,19 +40,19 @@ namespace System.Threading
         [System.ObsoleteAttribute("The ApartmentState property has been deprecated.  Use GetApartmentState, SetApartmentState or TrySetApartmentState instead.", false)]
         public System.Threading.ApartmentState ApartmentState { get { throw null; } set { } }
         public System.Globalization.CultureInfo CurrentCulture { get { throw null; } set { } }
-        public static System.Security.Principal.IPrincipal CurrentPrincipal { get { throw null; } set { } }
+        public static System.Security.Principal.IPrincipal? CurrentPrincipal { get { throw null; } set { } }
         public static System.Threading.Thread CurrentThread { get { throw null; } }
         public System.Globalization.CultureInfo CurrentUICulture { get { throw null; } set { } }
-        public System.Threading.ExecutionContext ExecutionContext { get { throw null; } }
+        public System.Threading.ExecutionContext? ExecutionContext { get { throw null; } }
         public bool IsAlive { get { throw null; } }
         public bool IsBackground { get { throw null; } set { } }
         public bool IsThreadPoolThread { get { throw null; } }
         public int ManagedThreadId { get { throw null; } }
-        public string Name { get { throw null; } set { } }
+        public string? Name { get { throw null; } set { } }
         public System.Threading.ThreadPriority Priority { get { throw null; } set { } }
         public System.Threading.ThreadState ThreadState { get { throw null; } }
         public void Abort() { }
-        public void Abort(object stateInfo) { }
+        public void Abort(object? stateInfo) { }
         public static System.LocalDataStoreSlot AllocateDataSlot() { throw null; }
         public static System.LocalDataStoreSlot AllocateNamedDataSlot(string name) { throw null; }
         public static void BeginCriticalRegion() { }
@@ -66,7 +66,7 @@ namespace System.Threading
         [System.ObsoleteAttribute("Thread.GetCompressedStack is no longer supported. Please use the System.Threading.CompressedStack class")]
         public System.Threading.CompressedStack GetCompressedStack() { throw null; }
         public static int GetCurrentProcessorId() { throw null; }
-        public static object GetData(System.LocalDataStoreSlot slot) { throw null; }
+        public static object? GetData(System.LocalDataStoreSlot slot) { throw null; }
         public static System.AppDomain GetDomain() { throw null; }
         public static int GetDomainID() { throw null; }
         public override int GetHashCode() { throw null; }
@@ -82,12 +82,12 @@ namespace System.Threading
         public void SetApartmentState(System.Threading.ApartmentState state) { }
         [System.ObsoleteAttribute("Thread.SetCompressedStack is no longer supported. Please use the System.Threading.CompressedStack class")]
         public void SetCompressedStack(System.Threading.CompressedStack stack) { }
-        public static void SetData(System.LocalDataStoreSlot slot, object data) { }
+        public static void SetData(System.LocalDataStoreSlot slot, object? data) { }
         public static void Sleep(int millisecondsTimeout) { }
         public static void Sleep(System.TimeSpan timeout) { }
         public static void SpinWait(int iterations) { }
         public void Start() { }
-        public void Start(object parameter) { }
+        public void Start(object? parameter) { }
         [System.ObsoleteAttribute("Thread.Suspend has been deprecated.  Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources.  https://go.microsoft.com/fwlink/?linkid=14202", false)]
         public void Suspend() { }
         public bool TrySetApartmentState(System.Threading.ApartmentState state) { throw null; }
@@ -97,7 +97,8 @@ namespace System.Threading
         public static int VolatileRead(ref int address) { throw null; }
         public static long VolatileRead(ref long address) { throw null; }
         public static System.IntPtr VolatileRead(ref System.IntPtr address) { throw null; }
-        public static object VolatileRead(ref object address) { throw null; }
+        [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("address")]
+        public static object? VolatileRead(ref object? address) { throw null; }
         [System.CLSCompliantAttribute(false)]
         public static sbyte VolatileRead(ref sbyte address) { throw null; }
         public static float VolatileRead(ref float address) { throw null; }
@@ -115,7 +116,7 @@ namespace System.Threading
         public static void VolatileWrite(ref int address, int value) { }
         public static void VolatileWrite(ref long address, long value) { }
         public static void VolatileWrite(ref System.IntPtr address, System.IntPtr value) { }
-        public static void VolatileWrite(ref object address, object value) { }
+        public static void VolatileWrite([System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")] ref object? address, object? value) { }
         [System.CLSCompliantAttribute(false)]
         public static void VolatileWrite(ref sbyte address, sbyte value) { }
         public static void VolatileWrite(ref float address, float value) { }
@@ -132,7 +133,7 @@ namespace System.Threading
     public sealed partial class ThreadAbortException : System.SystemException
     {
         internal ThreadAbortException() { }
-        public object ExceptionState { get { throw null; } }
+        public object? ExceptionState { get { throw null; } }
     }
     public partial class ThreadExceptionEventArgs : System.EventArgs
     {
@@ -144,8 +145,8 @@ namespace System.Threading
     {
         public ThreadInterruptedException() { }
         protected ThreadInterruptedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
-        public ThreadInterruptedException(string message) { }
-        public ThreadInterruptedException(string message, System.Exception innerException) { }
+        public ThreadInterruptedException(string? message) { }
+        public ThreadInterruptedException(string? message, System.Exception? innerException) { }
     }
     public enum ThreadPriority
     {
@@ -178,7 +179,7 @@ namespace System.Threading
     {
         public ThreadStateException() { }
         protected ThreadStateException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
-        public ThreadStateException(string message) { }
-        public ThreadStateException(string message, System.Exception innerException) { }
+        public ThreadStateException(string? message) { }
+        public ThreadStateException(string? message, System.Exception? innerException) { }
     }
 }
index ec7fbd6..65f79d5 100644 (file)
@@ -2,6 +2,7 @@
   <PropertyGroup>
     <ProjectGuid>{82D06A2D-008D-4A4A-A83D-FB7F04721C87}</ProjectGuid>
     <Configurations>netcoreapp-Debug;netcoreapp-Release;uap-Debug;uap-Release</Configurations>
+    <Nullable>enable</Nullable>
   </PropertyGroup>
   <ItemGroup>
     <Compile Include="System.Threading.Thread.cs" />