title: NuGet System.Drawing.Common .NET 6 CA1416 This call site is reachable on all platforms. 'Image.FromStream(Stream)' is only supported on: 'windows'
body: <p>Upgrading NuGet <code>System.Drawing.Common</code> to 6.0.0 causes the following error:</p>
  <blockquote>
  <p>CA1416 This call site is reachable on all platforms.
  'Image.FromStream(Stream)' is only supported on: 'windows'.</p>
  </blockquote>
  <p><a href="https://www.nuget.org/packages/System.Drawing.Common/" rel="noreferrer">https://www.nuget.org/packages/System.Drawing.Common/</a></p>
  <p>The affected code is the following:</p>
  <pre><code>var drawingImage = System.Drawing.Image.FromStream(memstr);
  </code></pre>
  <p>We use the library to access the method <code>GetThumbnailImage</code>.</p>
  <pre><code>public byte[] GetThumbnailBytes(byte[] imageBytes)
  {
      var thumbnailBytes = Array.Empty&lt;byte&gt;();
  
      using (MemoryStream memstr = new MemoryStream(imageBytes))
      {
          var drawingImage = System.Drawing.Image.FromStream(memstr);
          var thumbnailSize = GetThumbnailSize(drawingImage);
  
          var thumbnail = drawingImage.GetThumbnailImage(thumbnailSize.Width, thumbnailSize.Height, null, IntPtr.Zero);
  
          var ms = thumbnail.ToStream(drawingImage.RawFormat);
  
          thumbnailBytes = ms.ReadFully();
      }
  
      return thumbnailBytes;
  }
  </code></pre>
  <p>We only host the application on Azure so targeting Windows is fine but replacing <code>GetThumbnailImage</code> is acceptable as well.</p>