Marshal.GetDelegateForFunctionPointer(IntPtr, Type) is obsolete in

netstandard
pull/8438/head
Jan Tattermusch 9 years ago
parent 32cb42e046
commit d0e7c6d0b4
  1. 6
      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>

Loading…
Cancel
Save