diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2016-10-21 10:28:19 +0200 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2016-10-21 10:28:19 +0200 |
commit | d0e7c6d0b43aa067eed879a8c5d261ac65ab28a8 (patch) | |
tree | cb80f2c8b23fe3aa0f68909b96dba83000f0e10d /src/csharp | |
parent | 32cb42e046d2027804cc8a354dd8ebda4e912fd7 (diff) |
Marshal.GetDelegateForFunctionPointer(IntPtr, Type) is obsolete in
netstandard
Diffstat (limited to 'src/csharp')
-rw-r--r-- | src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs b/src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs index 31e1402849..1553bdd687 100644 --- a/src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs +++ b/src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs @@ -134,7 +134,11 @@ namespace Grpc.Core.Internal { throw new MissingMethodException(string.Format("The native method \"{0}\" does not exist", methodName)); } - return Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)) as T; +#if NETSTANDARD1_5 + return Marshal.GetDelegateForFunctionPointer<T>(ptr); // non-generic version is obsolete +#else + return Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)) as T; // generic version not available in .NET45 +#endif } /// <summary> |