20 [__DynamicallyInvokable]
23 internal sealed
class ResourceHelper
25 internal class GetResourceStringUserData
27 public ResourceHelper m_resourceHelper;
33 public string m_retVal;
35 public bool m_lockWasTaken;
37 public GetResourceStringUserData(ResourceHelper resourceHelper,
string key,
CultureInfo culture)
39 m_resourceHelper = resourceHelper;
45 private string m_name;
49 private Stack currentlyLoading;
51 internal bool resourceManagerInited;
53 private int infinitelyRecursingCount;
55 internal ResourceHelper(
string name)
60 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
61 internal string GetResourceString(
string key)
63 if (key ==
null || key.Length == 0)
65 return "[Resource lookup failed - null or empty resource name]";
67 return GetResourceString(key,
null);
70 [SecuritySafeCritical]
71 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
72 internal string GetResourceString(
string key,
CultureInfo culture)
74 if (key ==
null || key.Length == 0)
76 return "[Resource lookup failed - null or empty resource name]";
78 GetResourceStringUserData getResourceStringUserData =
new GetResourceStringUserData(
this, key, culture);
82 return getResourceStringUserData.m_retVal;
85 [SecuritySafeCritical]
86 private void GetResourceStringCode(
object userDataIn)
88 GetResourceStringUserData getResourceStringUserData = (GetResourceStringUserData)userDataIn;
89 ResourceHelper resourceHelper = getResourceStringUserData.m_resourceHelper;
90 string key = getResourceStringUserData.m_key;
91 CultureInfo culture = getResourceStringUserData.m_culture;
92 Monitor.
Enter(resourceHelper, ref getResourceStringUserData.m_lockWasTaken);
93 if (resourceHelper.currentlyLoading !=
null && resourceHelper.currentlyLoading.Count > 0 && resourceHelper.currentlyLoading.Contains(key))
95 if (resourceHelper.infinitelyRecursingCount > 0)
97 getResourceStringUserData.m_retVal =
"[Resource lookup failed - infinite recursion or critical failure detected.]";
100 resourceHelper.infinitelyRecursingCount++;
101 string message =
"Infinite recursion during resource lookup within mscorlib. This may be a bug in mscorlib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names. Resource name: " + key;
105 if (resourceHelper.currentlyLoading ==
null)
107 resourceHelper.currentlyLoading =
new Stack(4);
109 if (!resourceHelper.resourceManagerInited)
121 resourceHelper.resourceManagerInited =
true;
124 resourceHelper.currentlyLoading.Push(key);
125 if (resourceHelper.SystemResMgr ==
null)
129 string @
string = resourceHelper.SystemResMgr.GetString(key,
null);
130 resourceHelper.currentlyLoading.Pop();
131 getResourceStringUserData.m_retVal = @string;
135 private void GetResourceStringBackoutCode(
object userDataIn,
bool exceptionThrown)
137 GetResourceStringUserData getResourceStringUserData = (GetResourceStringUserData)userDataIn;
138 ResourceHelper resourceHelper = getResourceStringUserData.m_resourceHelper;
139 if (exceptionThrown && getResourceStringUserData.m_lockWasTaken)
141 resourceHelper.SystemResMgr =
null;
142 resourceHelper.currentlyLoading =
null;
144 if (getResourceStringUserData.m_lockWasTaken)
167 ApplicationData = 26,
169 CommonApplicationData = 35,
171 LocalApplicationData = 28,
181 InternetCache = 0x20,
205 DesktopDirectory = 0x10,
213 CommonProgramFiles = 43,
219 CommonAdminTools = 47,
221 CommonDocuments = 46,
229 CommonStartMenu = 22,
235 CommonDesktopDirectory = 25,
237 CommonTemplates = 45,
243 NetworkShortcuts = 19,
245 PrinterShortcuts = 27,
249 CommonProgramFilesX86 = 44,
251 ProgramFilesX86 = 42,
255 LocalizedResources = 57,
262 private const int MaxEnvVariableValueLength = 32767;
264 private const int MaxSystemEnvVariableLength = 1024;
266 private const int MaxUserEnvVariableLength = 255;
268 private static volatile ResourceHelper m_resHelper;
270 private const int MaxMachineNameLength = 256;
272 private static object s_InternalSyncObject;
276 private static volatile bool s_IsWindows8OrAbove;
278 private static volatile bool s_CheckedOSWin8OrAbove;
280 private static volatile bool s_WinRTSupported;
282 private static volatile bool s_CheckedWinRT;
284 private static volatile IntPtr processWinStation;
286 private static volatile bool isUserNonInteractive;
288 private static object InternalSyncObject
290 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
293 if (s_InternalSyncObject ==
null)
295 object value =
new object();
298 return s_InternalSyncObject;
304 [__DynamicallyInvokable]
308 [SecuritySafeCritical]
309 [__DynamicallyInvokable]
318 [SecuritySafeCritical]
321 [SecuritySafeCritical]
325 internal static bool IsCLRHosted
327 [SecuritySafeCritical]
330 return GetIsCLRHosted();
338 [SecuritySafeCritical]
343 GetCommandLine(JitHelpers.GetStringHandleOnStack(ref s));
371 [SecuritySafeCritical]
375 if (Win32Native.GetSystemDirectory(stringBuilder, 260) == 0)
377 __Error.WinIOError();
379 string text = stringBuilder.
ToString();
385 internal static string InternalWindowsDirectory
391 if (Win32Native.GetWindowsDirectory(stringBuilder, 260) == 0)
393 __Error.WinIOError();
404 [SecuritySafeCritical]
409 int bufferSize = 256;
410 if (Win32Native.GetComputerName(stringBuilder, ref bufferSize) == 0)
420 [__DynamicallyInvokable]
423 [SecuritySafeCritical]
424 [__DynamicallyInvokable]
427 return GetProcessorCount();
435 [SecuritySafeCritical]
439 Win32Native.SYSTEM_INFO lpSystemInfo =
default(Win32Native.SYSTEM_INFO);
440 Win32Native.GetSystemInfo(ref lpSystemInfo);
441 return lpSystemInfo.dwPageSize;
447 [__DynamicallyInvokable]
450 [__DynamicallyInvokable]
465 [SecuritySafeCritical]
469 return GetWorkingSet();
478 [SecuritySafeCritical]
483 Win32Native.OSVERSIONINFO oSVERSIONINFO =
new Win32Native.OSVERSIONINFO();
484 if (!GetVersion(oSVERSIONINFO))
488 Win32Native.OSVERSIONINFOEX oSVERSIONINFOEX =
new Win32Native.OSVERSIONINFOEX();
489 if (!GetVersionEx(oSVERSIONINFOEX))
494 Version version =
new Version(oSVERSIONINFO.MajorVersion, oSVERSIONINFO.MinorVersion, oSVERSIONINFO.BuildNumber, (oSVERSIONINFOEX.ServicePackMajor << 16) | oSVERSIONINFOEX.ServicePackMinor);
495 m_os =
new OperatingSystem(platform, version, oSVERSIONINFO.CSDVersion);
501 internal static bool IsWindows8OrAbove
505 if (!s_CheckedOSWin8OrAbove)
509 s_CheckedOSWin8OrAbove =
true;
511 return s_IsWindows8OrAbove;
515 internal static bool IsWinRTSupported
517 [SecuritySafeCritical]
522 s_WinRTSupported = WinRTSupported();
523 s_CheckedWinRT =
true;
525 return s_WinRTSupported;
531 [__DynamicallyInvokable]
534 [SecuritySafeCritical]
535 [__DynamicallyInvokable]
539 return GetStackTrace(
null, needFileInfo:
true);
553 [SecuritySafeCritical]
563 [__DynamicallyInvokable]
567 [SecuritySafeCritical]
568 [__DynamicallyInvokable]
576 [SecuritySafeCritical]
582 if (Win32Native.GetUserName(stringBuilder, ref nSize))
595 [SecuritySafeCritical]
598 IntPtr processWindowStation = Win32Native.GetProcessWindowStation();
599 if (processWindowStation !=
IntPtr.
Zero && processWinStation != processWindowStation)
601 int lpnLengthNeeded = 0;
602 Win32Native.USEROBJECTFLAGS uSEROBJECTFLAGS =
new Win32Native.USEROBJECTFLAGS();
603 if (Win32Native.GetUserObjectInformation(processWindowStation, 1, uSEROBJECTFLAGS,
Marshal.
SizeOf(uSEROBJECTFLAGS), ref lpnLengthNeeded) && (uSEROBJECTFLAGS.dwFlags & 1) == 0)
605 isUserNonInteractive =
true;
607 processWinStation = processWindowStation;
609 return !isUserNonInteractive;
619 [SecuritySafeCritical]
623 byte[] array =
new byte[1024];
624 int sidLen = array.Length;
626 uint domainNameLen = (uint)stringBuilder.
Capacity;
627 byte userNameEx = Win32Native.GetUserNameEx(2, stringBuilder, ref domainNameLen);
630 string text = stringBuilder.
ToString();
631 int num = text.IndexOf(
'\\');
634 return text.Substring(0, num);
637 domainNameLen = (uint)stringBuilder.
Capacity;
638 if (!Win32Native.LookupAccountName(
null,
UserName, array, ref sidLen, stringBuilder, ref domainNameLen, out
int _))
649 [__DynamicallyInvokable]
652 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
653 [__DynamicallyInvokable]
662 [SuppressUnmanagedCodeSecurity]
663 internal static extern void _Exit(
int exitCode);
668 [SecuritySafeCritical]
670 public static void Exit(
int exitCode)
679 [__DynamicallyInvokable]
680 public static extern void FailFast(
string message);
684 internal static extern void FailFast(
string message, uint exitCode);
691 [__DynamicallyInvokable]
696 [SuppressUnmanagedCodeSecurity]
697 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
698 internal static extern void TriggerCodeContractFailure(
ContractFailureKind failureKind,
string message,
string condition,
string exceptionAsString);
702 [SuppressUnmanagedCodeSecurity]
704 private static extern bool GetIsCLRHosted();
708 [SuppressUnmanagedCodeSecurity]
709 private static extern void GetCommandLine(StringHandleOnStack retString);
716 [SecuritySafeCritical]
717 [__DynamicallyInvokable]
724 if (name.Length == 0)
734 bool flag = CodeAccessSecurityEngine.QuickCheckForAllDemands();
735 string[] array = name.Split(
'%');
739 for (
int i = 1; i < array.Length - 1; i++)
741 if ((array[i].Length == 0) | flag2)
747 string text =
"%" + array[i] +
"%";
748 num2 = Win32Native.ExpandEnvironmentStrings(text, stringBuilder, num);
755 num = (stringBuilder.
Capacity = num2);
757 num2 = Win32Native.ExpandEnvironmentStrings(text, stringBuilder, num);
765 string a = stringBuilder.
ToString();
769 stringBuilder2.
Append(array[i]);
770 stringBuilder2.
Append(
';');
779 num2 = Win32Native.ExpandEnvironmentStrings(name, stringBuilder, num);
786 num = (stringBuilder.
Capacity = num2);
788 num2 = Win32Native.ExpandEnvironmentStrings(name, stringBuilder, num);
799 [SuppressUnmanagedCodeSecurity]
800 private static extern int GetProcessorCount();
805 [SecuritySafeCritical]
809 return GetCommandLineArgsNative();
814 private static extern string[] GetCommandLineArgsNative();
818 internal static extern string nativeGetEnvironmentVariable(
string variable);
826 [SecuritySafeCritical]
827 [__DynamicallyInvokable]
830 if (variable ==
null)
839 StringBuilder stringBuilder = StringBuilderCache.Acquire(128);
840 int environmentVariable = Win32Native.GetEnvironmentVariable(variable, stringBuilder, stringBuilder.
Capacity);
843 StringBuilderCache.Release(stringBuilder);
846 while (environmentVariable > stringBuilder.
Capacity)
848 stringBuilder.
Capacity = environmentVariable;
850 environmentVariable = Win32Native.GetEnvironmentVariable(variable, stringBuilder, stringBuilder.
Capacity);
852 return StringBuilderCache.GetStringAndRelease(stringBuilder);
864 [SecuritySafeCritical]
867 if (variable ==
null)
879 using (RegistryKey registryKey2 = Registry.LocalMachine.OpenSubKey(
"System\\CurrentControlSet\\Control\\Session Manager\\Environment", writable:
false))
881 if (registryKey2 ==
null)
885 return registryKey2.GetValue(variable) as string;
888 using (RegistryKey registryKey = Registry.CurrentUser.OpenSubKey(
"Environment", writable:
false))
890 if (registryKey ==
null)
894 return registryKey.GetValue(variable) as string;
897 throw new ArgumentException(GetResourceString(
"Arg_EnumIllegalVal", (
int)target));
902 private unsafe
static char[] GetEnvironmentCharArray()
904 char[] result =
null;
915 ptr = Win32Native.GetEnvironmentStrings();
918 throw new OutOfMemoryException();
921 for (ptr2 = ptr; *ptr2 != 0 || ptr2[1] != 0; ptr2++)
924 int num = (int)(ptr2 - ptr + 1);
925 result =
new char[num];
928 char[] array = result;
929 fixed (
char* dmem = array)
931 string.wstrcpy(dmem, ptr, num);
942 Win32Native.FreeEnvironmentStrings(ptr);
952 [SecuritySafeCritical]
953 [__DynamicallyInvokable]
960 bool flag = CodeAccessSecurityEngine.QuickCheckForAllDemands();
963 char[] environmentCharArray = GetEnvironmentCharArray();
965 for (
int i = 0; i < environmentCharArray.Length; i++)
968 for (; environmentCharArray[i] !=
'=' && environmentCharArray[i] != 0; i++)
971 if (environmentCharArray[i] ==
'\0')
977 for (; environmentCharArray[i] != 0; i++)
982 string text =
new string(environmentCharArray, num, i - num);
985 for (; environmentCharArray[i] != 0; i++)
988 string text3 = (string)(hashtable[text] =
new string(environmentCharArray, num2, i - num2));
997 stringBuilder.
Append(
';');
999 stringBuilder.
Append(text);
1009 internal static IDictionary GetRegistryKeyNameValuePairs(RegistryKey registryKey)
1012 if (registryKey !=
null)
1014 string[] valueNames = registryKey.GetValueNames();
1015 string[] array = valueNames;
1016 foreach (
string text
in array)
1018 string value = registryKey.GetValue(text,
"").ToString();
1019 hashtable.
Add(text, value);
1031 [SecuritySafeCritical]
1042 using (RegistryKey registryKey2 = Registry.LocalMachine.OpenSubKey(
"System\\CurrentControlSet\\Control\\Session Manager\\Environment", writable:
false))
1044 return GetRegistryKeyNameValuePairs(registryKey2);
1047 using (RegistryKey registryKey = Registry.CurrentUser.OpenSubKey(
"Environment", writable:
false))
1049 return GetRegistryKeyNameValuePairs(registryKey);
1052 throw new ArgumentException(GetResourceString(
"Arg_EnumIllegalVal", (
int)target));
1064 [SecuritySafeCritical]
1065 [__DynamicallyInvokable]
1068 CheckEnvironmentVariableName(variable);
1070 if (
string.IsNullOrEmpty(value) || value[0] ==
'\0')
1074 else if (value.Length >= 32767)
1082 if (!Win32Native.SetEnvironmentVariable(variable, value))
1085 switch (lastWin32Error)
1097 private static void CheckEnvironmentVariableName(
string variable)
1099 if (variable ==
null)
1103 if (variable.Length == 0)
1105 throw new ArgumentException(GetResourceString(
"Argument_StringZeroLength"),
"variable");
1107 if (variable[0] ==
'\0')
1109 throw new ArgumentException(GetResourceString(
"Argument_StringFirstCharIsZero"),
"variable");
1111 if (variable.Length >= 32767)
1113 throw new ArgumentException(GetResourceString(
"Argument_LongEnvVarValue"));
1115 if (variable.IndexOf(
'=') != -1)
1117 throw new ArgumentException(GetResourceString(
"Argument_IllegalEnvVarName"));
1133 [SecuritySafeCritical]
1141 CheckEnvironmentVariableName(variable);
1142 if (variable.Length >= 1024)
1147 if (
string.IsNullOrEmpty(value) || value[0] ==
'\0')
1154 using (RegistryKey registryKey2 = Registry.LocalMachine.OpenSubKey(
"System\\CurrentControlSet\\Control\\Session Manager\\Environment", writable:
true))
1156 if (registryKey2 !=
null)
1160 registryKey2.DeleteValue(variable, throwOnMissingValue:
false);
1164 registryKey2.SetValue(variable, value);
1170 if (variable.Length >= 255)
1174 using (RegistryKey registryKey = Registry.CurrentUser.OpenSubKey(
"Environment", writable:
true))
1176 if (registryKey !=
null)
1180 registryKey.DeleteValue(variable, throwOnMissingValue:
false);
1184 registryKey.SetValue(variable, value);
1190 throw new ArgumentException(GetResourceString(
"Arg_EnumIllegalVal", (
int)target));
1200 [SecuritySafeCritical]
1204 int logicalDrives = Win32Native.GetLogicalDrives();
1205 if (logicalDrives == 0)
1207 __Error.WinIOError();
1209 uint num = (uint)logicalDrives;
1219 string[] array =
new string[num2];
1220 char[] array2 =
new char[3]
1226 num = (uint)logicalDrives;
1232 array[num2++] =
new string(array2);
1235 array2[0] +=
'\u0001';
1242 [SuppressUnmanagedCodeSecurity]
1243 private static extern long GetWorkingSet();
1247 [SuppressUnmanagedCodeSecurity]
1249 private static extern bool WinRTSupported();
1253 internal static extern bool GetVersion(Win32Native.OSVERSIONINFO osVer);
1257 internal static extern bool GetVersionEx(Win32Native.OSVERSIONINFOEX osVer);
1259 internal static string GetStackTrace(
Exception e,
bool needFileInfo)
1265 [SecuritySafeCritical]
1266 private static void InitResourceHelper()
1268 bool lockTaken =
false;
1273 if (m_resHelper ==
null)
1275 ResourceHelper resHelper =
new ResourceHelper(
"mscorlib");
1277 m_resHelper = resHelper;
1291 internal static extern string GetResourceFromDefault(
string key);
1293 internal static string GetResourceStringLocal(
string key)
1295 if (m_resHelper ==
null)
1297 InitResourceHelper();
1299 return m_resHelper.GetResourceString(key);
1302 [SecuritySafeCritical]
1303 internal static string GetResourceString(
string key)
1305 return GetResourceFromDefault(key);
1308 [SecuritySafeCritical]
1309 internal static string GetResourceString(
string key, params
object[] values)
1311 string resourceString = GetResourceString(key);
1315 internal static string GetRuntimeResourceString(
string key)
1317 return GetResourceString(key);
1320 internal static string GetRuntimeResourceString(
string key, params
object[] values)
1322 return GetResourceString(key, values);
1327 internal static extern bool GetCompatibilityFlag(CompatibilityFlag flag);
1335 [SecuritySafeCritical]
1340 throw new ArgumentException(GetResourceString(
"Arg_EnumIllegalVal", (
int)folder));
1354 [SecuritySafeCritical]
1359 throw new ArgumentException(GetResourceString(
"Arg_EnumIllegalVal", (
int)folder));
1363 throw new ArgumentException(GetResourceString(
"Arg_EnumIllegalVal", (
int)option));
1365 return InternalGetFolderPath(folder, option);
1369 internal static string UnsafeGetFolderPath(
SpecialFolder folder)
1371 return InternalGetFolderPath(folder,
SpecialFolderOption.None, suppressSecurityChecks:
true);
1381 fileIOPermission.
Demand();
1384 int num = Win32Native.SHGetFolderPath(IntPtr.Zero, (
int)folder | (
int)option, IntPtr.Zero, 0, stringBuilder);
1388 if (num == -2146233031)
1390 throw new PlatformNotSupportedException();
1392 text =
string.Empty;
1398 if (!suppressSecurityChecks)
static Thread CurrentThread
Gets the currently running thread.
delegate void TryCode(object userData)
Represents a delegate to code that should be run in a try block..
static string NewLine
Gets the newline string defined for this environment.
static void Exit(int exitCode)
Terminates this process and returns an exit code to the operating system.
PlatformID
Identifies the operating system, or platform, supported by an assembly.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Describes a set of security permissions applied to code. This class cannot be inherited.
FileIOPermissionAccess
Specifies the type of file access requested.
virtual void Add(object key, object value)
Adds an element with the specified key and value into the T:System.Collections.Hashtable.
Represents a simple last-in-first-out (LIFO) non-generic collection of objects.
unsafe override string ToString()
Converts the value of this instance to a T:System.String.
static void MemoryBarrier()
Synchronizes memory access as follows: The processor executing the current thread cannot reorder inst...
SpecialFolder
Specifies enumerated constants used to retrieve directory paths to system special folders.
static void ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, object userData)
Executes code using a T:System.Delegate while using another T:System.Delegate to execute additional c...
static int ExitCode
Gets or sets the exit code of the process.
No initialization action.
Represents a stack trace, which is an ordered collection of one or more stack frames.
static string ExpandEnvironmentVariables(string name)
Replaces the name of each environment variable embedded in the specified string with the string equiv...
static int SystemPageSize
Gets the number of bytes in the operating system's memory page.
Provides a mechanism that synchronizes access to objects.
static int SizeOf(object structure)
Returns the unmanaged size of an object in bytes.
static bool HasShutdownStarted
Gets a value that indicates whether the current application domain is being unloaded or the common la...
static OperatingSystem OSVersion
Gets an T:System.OperatingSystem object that contains the current platform identifier and version num...
static bool Is64BitOperatingSystem
Determines whether the current operating system is a 64-bit operating system.
EnvironmentPermissionAccess
Specifies access to environment variables.
static int GetHRForLastWin32Error()
Returns the HRESULT corresponding to the last error incurred by Win32 code executed using T:System....
static IDictionary GetEnvironmentVariables()
Retrieves all environment variable names and their values from the current process.
static string CommandLine
Gets the command line for this process.
static string GetEnvironmentVariable(string variable)
Retrieves the value of an environment variable from the current process.
Specifies that the operating system should create a new file. If the file already exists,...
Represents a resource manager that provides convenient access to culture-specific resources at run ti...
Represents an application domain, which is an isolated environment where applications execute....
Version Version
Gets a T:System.Version object that identifies the operating system.
EnvironmentVariableTarget
Specifies the location where an environment variable is stored or retrieved in a set or get operation...
static Version Version
Gets a T:System.Version object that describes the major, minor, build, and revision numbers of the co...
Cer
Specifies a method's behavior when called within a constrained execution region.
PlatformID Platform
Gets a T:System.PlatformID enumeration value that identifies the operating system platform.
static void SetEnvironmentVariable(string variable, string value, EnvironmentVariableTarget target)
Creates, modifies, or deletes an environment variable stored in the current process or in the Windows...
static string GetFolderPath(SpecialFolder folder)
Gets the path to the system special folder that is identified by the specified enumeration.
SecurityAction
Specifies the security actions that can be performed using declarative security.
static void Enter(object obj)
Acquires an exclusive lock on the specified object.
Provides information about, and means to manipulate, the current environment and platform....
static bool IsDefined(Type enumType, object value)
Returns an indication whether a constant with a specified value exists in a specified enumeration.
StringBuilder Append(char value, int repeatCount)
Appends a specified number of copies of the string representation of a Unicode character to this inst...
int Major
Gets the value of the major component of the version number for the current T:System....
static string MachineName
Gets the NetBIOS name of this local computer.
UnmanagedType
Identifies how to marshal parameters or fields to unmanaged code.
Provides the base class for enumerations.
Exposes static methods for creating, moving, and enumerating through directories and subdirectories....
static void SetCurrentDirectory(string path)
Sets the application's current working directory to the specified directory.
static int CompareExchange(ref int location1, int value, int comparand)
Compares two 32-bit signed integers for equality and, if they are equal, replaces the first value.
Represents a collection of key/value pairs that are organized based on the hash code of the key....
static string SystemDirectory
Gets the fully qualified path of the system directory.
Reads primitive data types as binary values in a specific encoding.
static void ThrowExceptionForHR(int errorCode)
Throws an exception with a specific failure HRESULT value.
int Length
Gets or sets the length of the current T:System.Text.StringBuilder object.
static string StackTrace
Gets current stack trace information.
static int ProcessorCount
Gets the number of processors on the current machine.
A platform-specific type that is used to represent a pointer or a handle.
static void Exit(object obj)
Releases an exclusive lock on the specified object.
static void PrepareConstrainedRegions()
Designates a body of code as a constrained execution region (CER).
static string UserDomainName
Gets the network domain name associated with the current user.
override string ToString()
Builds a readable representation of the stack trace.
Provides a collection of methods for allocating unmanaged memory, copying unmanaged memory blocks,...
static int TickCount
Gets the number of milliseconds elapsed since the system started.
static string GetEnvironmentVariable(string variable, EnvironmentVariableTarget target)
Retrieves the value of an environment variable from the current process or from the Windows operating...
static string [] GetLogicalDrives()
Returns an array of string containing the names of the logical drives on the current computer.
Represents the version number of an assembly, operating system, or the common language runtime....
MethodImplOptions
Defines the details of how a method is implemented.
FileIOPermissionAccess AllFiles
Gets or sets the permitted access to all files.
CharSet
Dictates which character set marshaled strings should use.
static string GetCurrentDirectory()
Gets the current working directory of the application.
Enumerates the resources in a binary resources (.resources) file by reading sequential resource name/...
An Overload:System.Diagnostics.Contracts.Contract.Assert contract failed.
static bool UserInteractive
Gets a value indicating whether the current process is running in user interactive mode.
Represents a mutable string of characters. This class cannot be inherited.To browse the ....
static string GetFolderPath(SpecialFolder folder, SpecialFolderOption option)
Gets the path to the system special folder that is identified by the specified enumeration,...
static string UserName
Gets the user name of the person who is currently logged on to the Windows operating system.
Represents information about an operating system, such as the version and platform identifier....
static int CurrentManagedThreadId
Gets a unique identifier for the current managed thread.
static bool Is64BitProcess
Determines whether the current process is a 64-bit process.
static CultureInfo CurrentCulture
Gets or sets the T:System.Globalization.CultureInfo object that represents the culture used by the cu...
Attribute can be applied to an assembly.
The exception that is thrown when one of the arguments provided to a method is not valid.
void Demand()
Forces a T:System.Security.SecurityException at run time if all callers higher in the call stack have...
int Capacity
Gets or sets the maximum number of characters that can be contained in the memory allocated by the cu...
static long WorkingSet
Gets the amount of physical memory mapped to the process context.
int ManagedThreadId
Gets a unique identifier for the current managed thread.
PermissionState
Specifies whether a permission should have all or no access to resources at creation.
Represents errors that occur during application execution.To browse the .NET Framework source code fo...
The local computer zone is an implicit zone used for content that exists on the user's computer.
int Minor
Gets the value of the minor component of the version number for the current T:System....
SpecialFolderOption
Specifies options to use for getting the path to a special folder.
static IDictionary GetEnvironmentVariables(EnvironmentVariableTarget target)
Retrieves all environment variable names and their values from the current process,...
delegate void CleanupCode(object userData, bool exceptionThrown)
Represents a method to run when an exception occurs.
static readonly IntPtr Zero
A read-only field that represents a pointer or handle that has been initialized to zero.
static string [] GetCommandLineArgs()
Returns a string array containing the command-line arguments for the current process.
The exception that is thrown when a method call is invalid for the object's current state.
Controls access to system and user environment variables. This class cannot be inherited.
Consistency
Specifies a reliability contract.
Provides information about a specific culture (called a locale for unmanaged code development)....
Controls the ability to access files and folders. This class cannot be inherited.
static int GetLastWin32Error()
Returns the error code returned by the last unmanaged function that was called using platform invoke ...
static void RunClassConstructor(RuntimeTypeHandle type)
Runs a specified class constructor method.
SecurityPermissionFlag
Specifies access flags for the security permission object.
static string CurrentDirectory
Gets or sets the fully qualified path of the current working directory.
Represents a nongeneric collection of key/value pairs.
Provides atomic operations for variables that are shared by multiple threads.
static void SetEnvironmentVariable(string variable, string value)
Creates, modifies, or deletes an environment variable stored in the current process.
static void FailFast(string message)
Immediately terminates a process after writing a message to the Windows Application event log,...
Provides a set of static methods and properties that provide support for compilers....
ContractFailureKind
Specifies the type of contract that failed.
Creates and controls a thread, sets its priority, and gets its status.