aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2017-08-09 19:50:19 +0200
committerGravatar Jan Tattermusch <jtattermusch@google.com>2017-08-11 18:17:19 +0200
commit271cb36f5639ed465f919c9736015bd98a7b7540 (patch)
tree25518a8e774289f6a74b2ecb0572baf60db52912 /src/csharp
parent2fb313c9b6ff46d241e94e7a9eddbd6a1e698e03 (diff)
dont use generic version of PtrToStructure
Diffstat (limited to 'src/csharp')
-rw-r--r--src/csharp/Grpc.Core/Internal/AuthContextSafeHandle.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/csharp/Grpc.Core/Internal/AuthContextSafeHandle.cs b/src/csharp/Grpc.Core/Internal/AuthContextSafeHandle.cs
index f7a6b320a7..3f5ba27c19 100644
--- a/src/csharp/Grpc.Core/Internal/AuthContextSafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/AuthContextSafeHandle.cs
@@ -74,7 +74,11 @@ namespace Grpc.Core.Internal
private AuthProperty PtrToAuthProperty(IntPtr authPropertyPtr)
{
- var nativeAuthProperty = Marshal.PtrToStructure<NativeAuthProperty>(authPropertyPtr);
+ #pragma warning disable 0618
+ // We need to use the obsolete non-generic version of Marshal.PtrToStructure, because the generic version is not available
+ // in net45 on Windows.
+ var nativeAuthProperty = (NativeAuthProperty) Marshal.PtrToStructure(authPropertyPtr, typeof(NativeAuthProperty));
+ #pragma warning restore 0618
var name = Marshal.PtrToStringAnsi(nativeAuthProperty.Name);
var valueBytes = new byte[(int) nativeAuthProperty.ValueLength];
Marshal.Copy(nativeAuthProperty.Value, valueBytes, 0, (int)nativeAuthProperty.ValueLength);