From 81a4124270b4b743363dcf8bf057a8d0c9a69ce0 Mon Sep 17 00:00:00 2001 From: Santiago Fernandez Madero Date: Fri, 14 Jun 2019 18:55:50 -0700 Subject: [PATCH] Add nullable annotations to System.Threading.Overlapped ref (dotnet/corefx#38298) * Add nullable attributes to System.Threading.Overlapped ref * Address feedback from API Review Commit migrated from https://github.com/dotnet/corefx/commit/5fa3d3b8f89302202091993681391c9b356755a7 --- .../ref/System.Threading.Overlapped.cs | 20 ++++++++++---------- .../ref/System.Threading.Overlapped.csproj | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/libraries/System.Threading.Overlapped/ref/System.Threading.Overlapped.cs b/src/libraries/System.Threading.Overlapped/ref/System.Threading.Overlapped.cs index d313d32..17c63ca 100644 --- a/src/libraries/System.Threading.Overlapped/ref/System.Threading.Overlapped.cs +++ b/src/libraries/System.Threading.Overlapped/ref/System.Threading.Overlapped.cs @@ -21,9 +21,9 @@ namespace System.Threading { public Overlapped() { } [System.ObsoleteAttribute("This constructor is not 64-bit compatible. Use the constructor that takes an IntPtr for the event handle. https://go.microsoft.com/fwlink/?linkid=14202")] - public Overlapped(int offsetLo, int offsetHi, int hEvent, System.IAsyncResult ar) { } - public Overlapped(int offsetLo, int offsetHi, System.IntPtr hEvent, System.IAsyncResult ar) { } - public System.IAsyncResult AsyncResult { get { throw null; } set { } } + public Overlapped(int offsetLo, int offsetHi, int hEvent, System.IAsyncResult? ar) { } + public Overlapped(int offsetLo, int offsetHi, System.IntPtr hEvent, System.IAsyncResult? ar) { } + public System.IAsyncResult? AsyncResult { get { throw null; } set { } } [System.ObsoleteAttribute("This property is not 64-bit compatible. Use EventHandleIntPtr instead. https://go.microsoft.com/fwlink/?linkid=14202")] public int EventHandle { get { throw null; } set { } } public System.IntPtr EventHandleIntPtr { get { throw null; } set { } } @@ -33,21 +33,21 @@ namespace System.Threading public unsafe static void Free(System.Threading.NativeOverlapped* nativeOverlappedPtr) { } [System.CLSCompliantAttribute(false)] [System.ObsoleteAttribute("This method is not safe. Use Pack (iocb, userData) instead. https://go.microsoft.com/fwlink/?linkid=14202")] - public unsafe System.Threading.NativeOverlapped* Pack(System.Threading.IOCompletionCallback iocb) { throw null; } + public unsafe System.Threading.NativeOverlapped* Pack(System.Threading.IOCompletionCallback? iocb) { throw null; } [System.CLSCompliantAttribute(false)] - public unsafe System.Threading.NativeOverlapped* Pack(System.Threading.IOCompletionCallback iocb, object userData) { throw null; } + public unsafe System.Threading.NativeOverlapped* Pack(System.Threading.IOCompletionCallback? iocb, object? userData) { throw null; } [System.CLSCompliantAttribute(false)] public unsafe static System.Threading.Overlapped Unpack(System.Threading.NativeOverlapped* nativeOverlappedPtr) { throw null; } [System.CLSCompliantAttribute(false)] [System.ObsoleteAttribute("This method is not safe. Use UnsafePack (iocb, userData) instead. https://go.microsoft.com/fwlink/?linkid=14202")] - public unsafe System.Threading.NativeOverlapped* UnsafePack(System.Threading.IOCompletionCallback iocb) { throw null; } + public unsafe System.Threading.NativeOverlapped* UnsafePack(System.Threading.IOCompletionCallback? iocb) { throw null; } [System.CLSCompliantAttribute(false)] - public unsafe System.Threading.NativeOverlapped* UnsafePack(System.Threading.IOCompletionCallback iocb, object userData) { throw null; } + public unsafe System.Threading.NativeOverlapped* UnsafePack(System.Threading.IOCompletionCallback? iocb, object? userData) { throw null; } } public sealed partial class PreAllocatedOverlapped : System.IDisposable { [System.CLSCompliantAttribute(false)] - public PreAllocatedOverlapped(System.Threading.IOCompletionCallback callback, object state, object pinData) { } + public PreAllocatedOverlapped(System.Threading.IOCompletionCallback callback, object? state, object? pinData) { } public void Dispose() { } ~PreAllocatedOverlapped() { } } @@ -56,7 +56,7 @@ namespace System.Threading internal ThreadPoolBoundHandle() { } public System.Runtime.InteropServices.SafeHandle Handle { get { throw null; } } [System.CLSCompliantAttribute(false)] - public unsafe System.Threading.NativeOverlapped* AllocateNativeOverlapped(System.Threading.IOCompletionCallback callback, object state, object pinData) { throw null; } + public unsafe System.Threading.NativeOverlapped* AllocateNativeOverlapped(System.Threading.IOCompletionCallback callback, object? state, object? pinData) { throw null; } [System.CLSCompliantAttribute(false)] public unsafe System.Threading.NativeOverlapped* AllocateNativeOverlapped(System.Threading.PreAllocatedOverlapped preAllocated) { throw null; } public static System.Threading.ThreadPoolBoundHandle BindHandle(System.Runtime.InteropServices.SafeHandle handle) { throw null; } @@ -64,6 +64,6 @@ namespace System.Threading [System.CLSCompliantAttribute(false)] public unsafe void FreeNativeOverlapped(System.Threading.NativeOverlapped* overlapped) { } [System.CLSCompliantAttribute(false)] - public unsafe static object GetNativeOverlappedState(System.Threading.NativeOverlapped* overlapped) { throw null; } + public unsafe static object? GetNativeOverlappedState(System.Threading.NativeOverlapped* overlapped) { throw null; } } } diff --git a/src/libraries/System.Threading.Overlapped/ref/System.Threading.Overlapped.csproj b/src/libraries/System.Threading.Overlapped/ref/System.Threading.Overlapped.csproj index 8d30d7d..119cfce 100644 --- a/src/libraries/System.Threading.Overlapped/ref/System.Threading.Overlapped.csproj +++ b/src/libraries/System.Threading.Overlapped/ref/System.Threading.Overlapped.csproj @@ -3,6 +3,7 @@ true {F71467DF-30C1-44A0-A15A-163CB5DB4E6E} netcoreapp-Debug;netcoreapp-Release;uap-Debug;uap-Release + enable -- 2.7.4