We intend to merge the Platform Compatibility Analyzer into the .NET 5.0 RC1 SDK. When the updated version of the NetAnalyzers package is taken into the dotnet/runtime repo that contains this analyzer, it will introduce build warnings. Those build warnings surface because:
[SupportedOSPlatform] and [UnsupportedOSPlatform] attributes to many APIs nowBecause these warnings will occur, we are going to disable the analyzer in the dotnet/runtime repo before merging it into the SDK. Before we ship .NET 5.0 RC2 though, we want to re-enable the analyzer and address all of the warnings introduced.
See #41209 for a draft PR where we updated the infrastructure to allow MSBuild properties for applying assembly-wide attributes. We should include that infrastructure work as part of this issue, including the detail of producing a build error if an assembly attempts to define _both_ Supported and Unsupported platforms at the assembly-level.
It'd be fine to enable the analyzer for master branch only and we'd backport fixes if there would be any.
Overall 41 warnings found with local build, all looks valid warnings and should be suppressed if window targets are appropriately produced the SupportedOSPlatform attribute local warnings.txt
Overall 48 warnings found with -allconfigurations build 22 of them repeated, so its 26 build warnings for real. Somehow warnings in Microsoft.Extensions.Logging.EventLog.csproj and System.IO.Ports.csproj are missing from -allconfigurations build. Results attached warnings with allconfiguration.txt
@buyaa-n can you post instructions on how to recreate these lists so that if someone else picks this issue up, they'll be able to reproduce the list and test their work?
Sure:
build -subset libs -runtimeConfiguration release /p:TreatWarningsAsErrors=false , command used for producing errors in allconfig: build -subset libs -allconfiguration /p:TreatWarningsAsErrors=falseTo resolve this, we should:
master, while leaving the analyzer disabledrelease/5.0-rc2 branch (with an Ask Mode approval request)master; this will not be ported into release/5.0@jeffhandley is this work still planned for the 5.0 codebase? Should it be marked blocking?
Update to the plan above based on the results of #41760: /cc @ericstj
This was resolved for 6.0.0 (master) with #41760. We will not port any of this into the 5.0 branches since no public API surface area was affected.
Most helpful comment
It'd be fine to enable the analyzer for master branch only and we'd backport fixes if there would be any.