1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 using System
.Collections
;
6 using System
.Globalization
;
7 using System
.Diagnostics
;
8 using System
.Runtime
.CompilerServices
;
9 using System
.Threading
;
13 partial class Environment
15 public static int CurrentManagedThreadId
=> Thread
.CurrentThread
.ManagedThreadId
;
17 public extern static int ExitCode
{
18 [MethodImplAttribute (MethodImplOptions
.InternalCall
)]
20 [MethodImplAttribute (MethodImplOptions
.InternalCall
)]
24 public static extern bool HasShutdownStarted
{
25 [MethodImplAttribute (MethodImplOptions
.InternalCall
)]
29 public static extern int ProcessorCount
{
30 [MethodImplAttribute (MethodImplOptions
.InternalCall
)]
34 public static string StackTrace
{
35 [MethodImpl (MethodImplOptions
.NoInlining
)] // Prevent inlining from affecting where the stacktrace starts
36 get => new StackTrace (true).ToString (System
.Diagnostics
.StackTrace
.TraceFormat
.Normal
);
39 public extern static int TickCount
{
40 [MethodImplAttribute (MethodImplOptions
.InternalCall
)]
44 public extern static long TickCount64
{
45 [MethodImplAttribute (MethodImplOptions
.InternalCall
)]
49 [MethodImplAttribute (MethodImplOptions
.InternalCall
)]
50 public extern static void Exit (int exitCode
);
52 [MethodImplAttribute (MethodImplOptions
.InternalCall
)]
53 public extern static string[] GetCommandLineArgs ();
55 public static void FailFast (string message
)
57 FailFast (message
, null, null);
60 public static void FailFast(string message
, Exception exception
)
62 FailFast (message
, exception
, null);
65 [MethodImplAttribute (MethodImplOptions
.InternalCall
)]
66 public extern static void FailFast (string message
, Exception exception
, string errorSource
);
69 #region referencesource dependencies - to be removed
71 partial class Environment
73 internal static string GetResourceString (string key
)
78 internal static string GetResourceString (string key
, CultureInfo culture
)
83 internal static string GetResourceString (string key
, params object[] values
)
85 return string.Format (CultureInfo
.InvariantCulture
, key
, values
);