Home > Software design >  CA1416 This call site is reachable on all platforms. 'Image.FromStream(Stream)' is only su
CA1416 This call site is reachable on all platforms. 'Image.FromStream(Stream)' is only su

Time:12-11

Upgrading NuGet System.Drawing.Common to 6.0.0 causes the following error:

CA1416 This call site is reachable on all platforms. 'Image.FromStream(Stream)' is only supported on: 'windows'.

enter image description here

But this code won't warn if the project targets Windows

https://docs.microsoft.com/en-us/dotnet/core/compatibility/code-analysis/5.0/ca1416-platform-compatibility-analyzer

CodePudding user response:

This has been an long open issue

I have got around it by editing my shared assembly info (not autogenerated) with

#if NET6_0
[assembly: System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
#endif
  • Related