From 7d489f6a446984b052486a938b72e80c7df49c4d Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 29 Mar 2019 12:39:45 -0400 Subject: [PATCH] use process architecture instead of OS architecture --- src/csharp/Grpc.Tools/Common.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/csharp/Grpc.Tools/Common.cs b/src/csharp/Grpc.Tools/Common.cs index d6359804953..13cd6a32316 100644 --- a/src/csharp/Grpc.Tools/Common.cs +++ b/src/csharp/Grpc.Tools/Common.cs @@ -60,7 +60,7 @@ namespace Grpc.Tools : RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? OsKind.MacOsX : OsKind.Unknown; - switch (RuntimeInformation.OSArchitecture) + switch (RuntimeInformation.ProcessArchitecture) { case Architecture.X86: Cpu = CpuKind.X86; break; case Architecture.X64: Cpu = CpuKind.X64; break; @@ -86,17 +86,7 @@ namespace Grpc.Tools } // Hope we are not building on ARM under Xamarin! - Cpu = Environment.Is64BitOperatingSystem ? CpuKind.X64 : CpuKind.X86; - - // See https://github.com/grpc/grpc/issues/18543 - // Problem: Is64BitOperatingSystem returns "true" inside a 32-bit docker container. - // Workaround: Mono is 64-bit by default on linux, so we get around - // this by assuming 32-bit mono linux process means - // we should invoke 32-bit version of protoc. - if (Os == OsKind.Linux && !Environment.Is64BitProcess) - { - Cpu = CpuKind.X86; - } + Cpu = Environment.Is64BitProcess ? CpuKind.X64 : CpuKind.X86; #endif } };