From 271cb36f5639ed465f919c9736015bd98a7b7540 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 9 Aug 2017 19:50:19 +0200 Subject: dont use generic version of PtrToStructure --- src/csharp/Grpc.Core/Internal/AuthContextSafeHandle.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/csharp/Grpc.Core') 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(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); -- cgit v1.2.3