aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core/Internal
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2018-07-23 19:13:41 +0200
committerGravatar Jan Tattermusch <jtattermusch@google.com>2018-07-23 19:17:01 +0200
commit0b907fc9d1cc37a69ab7877567154be8ab757e7f (patch)
tree82c8a45b251d4e1597905f5e39843dbf55ce0ba7 /src/csharp/Grpc.Core/Internal
parentcebab02bf4ee3f8d38609d4c76030607073ca179 (diff)
improve xamarin platform detection
Diffstat (limited to 'src/csharp/Grpc.Core/Internal')
-rw-r--r--src/csharp/Grpc.Core/Internal/PlatformApis.cs17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/csharp/Grpc.Core/Internal/PlatformApis.cs b/src/csharp/Grpc.Core/Internal/PlatformApis.cs
index 6c4ee0bdb7..c501aa89fb 100644
--- a/src/csharp/Grpc.Core/Internal/PlatformApis.cs
+++ b/src/csharp/Grpc.Core/Internal/PlatformApis.cs
@@ -33,8 +33,9 @@ namespace Grpc.Core.Internal
internal static class PlatformApis
{
const string UnityEngineApplicationClassName = "UnityEngine.Application, UnityEngine";
- const string XamarinAndroidActivityClassName = "Android.App.Activity, Mono.Android";
- const string XamariniOSEnumClassName = "Mono.CSharp.Enum, Mono.CSharp";
+ const string XamarinAndroidObjectClassName = "Java.Lang.Object, Mono.Android";
+ const string XamarinIOSObjectClassName = "Foundation.NSObject, Xamarin.iOS";
+
static readonly bool isLinux;
static readonly bool isMacOSX;
static readonly bool isWindows;
@@ -42,7 +43,7 @@ namespace Grpc.Core.Internal
static readonly bool isNetCore;
static readonly bool isUnity;
static readonly bool isXamarin;
- static readonly bool isXamariniOS;
+ static readonly bool isXamarinIOS;
static readonly bool isXamarinAndroid;
static PlatformApis()
@@ -63,9 +64,9 @@ namespace Grpc.Core.Internal
#endif
isMono = Type.GetType("Mono.Runtime") != null;
isUnity = Type.GetType(UnityEngineApplicationClassName) != null;
- isXamariniOS = Type.GetType(XamariniOSEnumClassName) != null;
- isXamarinAndroid = Type.GetType(XamarinAndroidActivityClassName) != null;
- isXamarin = isXamariniOS || isXamarinAndroid;
+ isXamarinIOS = Type.GetType(XamarinIOSObjectClassName) != null;
+ isXamarinAndroid = Type.GetType(XamarinAndroidObjectClassName) != null;
+ isXamarin = isXamarinIOS || isXamarinAndroid;
}
public static bool IsLinux
@@ -108,9 +109,9 @@ namespace Grpc.Core.Internal
/// <summary>
/// true if running on Xamarin.iOS, false otherwise.
/// </summary>
- public static bool IsXamariniOS
+ public static bool IsXamarinIOS
{
- get { return isXamariniOS; }
+ get { return isXamarinIOS; }
}
/// <summary>