diff --git a/src/System.Private.CoreLib/src/Internal/Runtime/Augments/EnvironmentAugments.cs b/src/System.Private.CoreLib/src/Internal/Runtime/Augments/EnvironmentAugments.cs
new file mode 100644
index 00000000000..de915e984f2
--- /dev/null
+++ b/src/System.Private.CoreLib/src/Internal/Runtime/Augments/EnvironmentAugments.cs
@@ -0,0 +1,21 @@
+// 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;
+
+namespace Internal.Runtime.Augments
+{
+ /// For internal use only. Exposes runtime functionality to the Environments implementation in corefx.
+ public static class EnvironmentAugments
+ {
+ public static int CurrentManagedThreadId => Environment.CurrentManagedThreadId;
+ public static void Exit(int exitCode) => Environment.Exit(exitCode);
+ public static int ExitCode { get { return 0; } set { throw new PlatformNotSupportedException(); } }
+ public static void FailFast(string message, Exception error) => Environment.FailFast(message, error);
+ public static string[] GetCommandLineArgs() => Environment.GetCommandLineArgs();
+ public static bool HasShutdownStarted => Environment.HasShutdownStarted;
+ public static string StackTrace => Environment.StackTrace;
+ public static int TickCount => Environment.TickCount;
+ }
+}
diff --git a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
index cd1cabc5b53..6b6efcd53df 100644
--- a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
+++ b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
@@ -86,6 +86,7 @@
+
diff --git a/src/System.Private.CoreLib/src/System/Environment.cs b/src/System.Private.CoreLib/src/System/Environment.cs
index 0af58e76b27..e2c8b2c87c2 100644
--- a/src/System.Private.CoreLib/src/System/Environment.cs
+++ b/src/System.Private.CoreLib/src/System/Environment.cs
@@ -105,7 +105,6 @@ public static String NewLine
}
}
-#if CORERT
private static string[] s_commandLineArgs;
internal static void SetCommandLineArgs(string[] args)
@@ -115,9 +114,8 @@ internal static void SetCommandLineArgs(string[] args)
public static string[] GetCommandLineArgs()
{
- return (string[])s_commandLineArgs.Clone();
+ return (string[])s_commandLineArgs?.Clone();
}
-#endif
public static String StackTrace
{