Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>For internal use only. Exposes runtime functionality to the Environments implementation in corefx.</summary>
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();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause build break when integrated to TFS. Environment.GetCommandLineArgs was not implemented for .NET Native for UWP yet - it is under CORERT ifdef. We should remove the CORERT ifdef in Environment.cs. It won't make it work, but it will be good enough to fix the build break.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. Thanks.

public static bool HasShutdownStarted => Environment.HasShutdownStarted;
public static string StackTrace => Environment.StackTrace;
public static int TickCount => Environment.TickCount;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
<Compile Include="Internal\Runtime\Augments\DesktopSupportCallbacks.cs" />
<Compile Include="Internal\Runtime\Augments\DynamicDelegateAugments.cs" />
<Compile Include="Internal\Runtime\Augments\EnumInfo.cs" />
<Compile Include="Internal\Runtime\Augments\EnvironmentAugments.cs" />
</ItemGroup>

<ItemGroup Condition="'$(IsProjectNLibrary)' == 'true'">
Expand Down
4 changes: 1 addition & 3 deletions src/System.Private.CoreLib/src/System/Environment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ public static String NewLine
}
}

#if CORERT
private static string[] s_commandLineArgs;

internal static void SetCommandLineArgs(string[] args)
Expand All @@ -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
{
Expand Down