Move two sharable classes into the shared partition. (dotnet/coreclr#10009)
authorAtsushi Kanamori <AtsushiKan@users.noreply.github.com>
Wed, 8 Mar 2017 08:23:30 +0000 (00:23 -0800)
committerJan Kotas <jkotas@microsoft.com>
Wed, 8 Mar 2017 08:23:30 +0000 (00:23 -0800)
The corert side of this was commited by
  https://github.com/dotnet/corert/pull/2915#event-990346611

Commit migrated from https://github.com/dotnet/coreclr/commit/fe28e4034928d4d2daa3144de8d14013d18af468

src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/CriticalHandleMinusOneIsInvalid.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/CriticalHandleZeroOrMinusOneIsInvalid.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs

diff --git a/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/CriticalHandleMinusOneIsInvalid.cs b/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/CriticalHandleMinusOneIsInvalid.cs
new file mode 100644 (file)
index 0000000..a76c51d
--- /dev/null
@@ -0,0 +1,20 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.Win32.SafeHandles
+{
+    // Class of critical handle which uses only -1 as an invalid handle.
+    public abstract class CriticalHandleMinusOneIsInvalid : CriticalHandle
+    {
+        protected CriticalHandleMinusOneIsInvalid()
+            : base(new IntPtr(-1))
+        {
+        }
+
+        public override bool IsInvalid => handle == new IntPtr(-1);
+    }
+}
diff --git a/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/CriticalHandleZeroOrMinusOneIsInvalid.cs b/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/CriticalHandleZeroOrMinusOneIsInvalid.cs
new file mode 100644 (file)
index 0000000..195e48d
--- /dev/null
@@ -0,0 +1,20 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.Win32.SafeHandles
+{
+    // Class of critical handle which uses 0 or -1 as an invalid handle.
+    public abstract class CriticalHandleZeroOrMinusOneIsInvalid : CriticalHandle
+    {
+        protected CriticalHandleZeroOrMinusOneIsInvalid()
+            : base(IntPtr.Zero)
+        {
+        }
+
+        public override bool IsInvalid => handle.IsNull() || handle == new IntPtr(-1);
+    }
+}
index e2a8291..0d1670f 100644 (file)
     <Compile Include="$(MSBuildThisFileDirectory)System\UnhandledExceptionEventArgs.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\UnhandledExceptionEventHandler.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Void.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\CriticalHandleMinusOneIsInvalid.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\CriticalHandleZeroOrMinusOneIsInvalid.cs"/>
   </ItemGroup>
   <ItemGroup Condition="$(TargetsWindows)">
     <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.Win32.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
index 80c8deb..8a7f591 100644 (file)
@@ -57,30 +57,4 @@ namespace Microsoft.Win32.SafeHandles
             get { return handle == new IntPtr(-1); }
         }
     }
-
-    // Class of critical handle which uses 0 or -1 as an invalid handle.
-    public abstract class CriticalHandleZeroOrMinusOneIsInvalid : CriticalHandle
-    {
-        protected CriticalHandleZeroOrMinusOneIsInvalid() : base(IntPtr.Zero)
-        {
-        }
-
-        public override bool IsInvalid
-        {
-            get { return handle.IsNull() || handle == new IntPtr(-1); }
-        }
-    }
-
-    // Class of critical handle which uses only -1 as an invalid handle.
-    public abstract class CriticalHandleMinusOneIsInvalid : CriticalHandle
-    {
-        protected CriticalHandleMinusOneIsInvalid() : base(new IntPtr(-1))
-        {
-        }
-
-        public override bool IsInvalid
-        {
-            get { return handle == new IntPtr(-1); }
-        }
-    }
 }