public OperatingSystem() { // Don't do the detection yourself. Use System.IO.Path.DirectorySeparatorChar. // Also, if you always use Path to manipulate paths then you should get formatting that you need. // This also works with URLs. m_arch = System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture; m_isARM = (m_arch == System.Runtime.InteropServices.Architecture.Arm || m_arch == System.Runtime.InteropServices.Architecture.Arm64); m_isX86 = (m_arch == System.Runtime.InteropServices.Architecture.X86 || m_arch == System.Runtime.InteropServices.Architecture.X64); m_isLinux = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Linux); m_isOSX = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.OSX); m_isWindows = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Windows); if (m_isLinux || m_isOSX) { m_platform = PlatformID.Unix; } else if (m_isWindows) { m_platform = PlatformID.Win32NT; } else { throw new PlatformNotSupportedException("Operating system not supported."); } }
// TODO: Fix R2RDump issue where an R2R image cannot be dissassembled with the x86 CoreDisTools // For the short term, we want to error out with a decent message explaining the unexpected error // Issue https://github.com/dotnet/coreclr/issues/19564 public bool DisassemblerArchitectureSupported() { System.Runtime.InteropServices.Architecture val = System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture; return(val != System.Runtime.InteropServices.Architecture.X86); }