aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2016-10-21 10:28:19 +0200
committerGravatar Jan Tattermusch <jtattermusch@google.com>2016-10-21 10:28:19 +0200
commitd0e7c6d0b43aa067eed879a8c5d261ac65ab28a8 (patch)
treecb80f2c8b23fe3aa0f68909b96dba83000f0e10d /src
parent32cb42e046d2027804cc8a354dd8ebda4e912fd7 (diff)
Marshal.GetDelegateForFunctionPointer(IntPtr, Type) is obsolete in
netstandard
Diffstat (limited to 'src')
-rw-r--r--src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs6
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>