From d0e7c6d0b43aa067eed879a8c5d261ac65ab28a8 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 21 Oct 2016 10:28:19 +0200 Subject: Marshal.GetDelegateForFunctionPointer(IntPtr, Type) is obsolete in netstandard --- src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') 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(ptr); // non-generic version is obsolete +#else + return Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)) as T; // generic version not available in .NET45 +#endif } /// -- cgit v1.2.3