googleads / google-ads-dotnet

This project hosts the .NET client library for the Google Ads API.

Home Page:https://developers.google.com/google-ads/api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Let's disallow Grpc.Net.Client on .NET Framework...

AnashOommen opened this issue · comments

I was hoping that https://github.com/googleads/google-ads-dotnet/blob/main/Google.Ads.Gax/src/Lib/AdsChannel.cs#L71 will work well across both .NET Framework and .NET Core, but we keep running into corner cases. See #488 where there are complaints about 'System.PlatformNotSupportedException' in Grpc.Net.Client.dll.

It seems safer to just force false on the DetectGrpcNetClientTransport method. The downside is that we will miss any future improvements to broader support of .NET Framework on Grpc.Net.Client, but that's less important when compared to providing a more stable library for our developers.

private static bool DetectGrpcNetClientTransport()
{
#if NET451_OR_GREATER
  return false;
#endif
  try
  {
    GrpcChannel.ForAddress("https://ignored.com");
    return true;
  }
  catch
  {
    return false;
  }
}