dont use generic version of PtrToStructure

pull/12127/head
Jan Tattermusch 8 years ago
parent 2fb313c9b6
commit 271cb36f56
  1. 6
      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);

Loading…
Cancel
Save