aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-10-22 10:04:12 +0200
committerGravatar GitHub <noreply@github.com>2016-10-22 10:04:12 +0200
commit8834095e7642310cc09c43ccf5ec0184bd48a5cd (patch)
treefc1efe711abcdb6fb7cbf957906002108974a396 /src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs
parent99e61f884d0c2b1e1e2af9a41ec2018b47041fec (diff)
parent9f254c0c40f85702221d2b14de7dd8b7cdac5cba (diff)
Merge pull request #8438 from jtattermusch/csharp_compiler_warnings
Fix a few C# compiler warnings
Diffstat (limited to 'src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs')
-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>