dotnet / extensions

This repository contains a suite of libraries that provide facilities commonly needed when creating production-ready applications.
MIT License
2.55k stars 731 forks source link

Confusing warning when Extensions are used with .NET Framework TFM #5162

Open xakep139 opened 1 month ago

xakep139 commented 1 month ago

When one of Extensions package is referenced in a .NET FX application, there will be a warning emitted:

warning : Microsoft.Extensions.Compliance.Abstractions 8.2.0 doesn't support net462 and has not been tested with it. Consider upgrading your TargetFramework to net6.0 or later. You may also set <SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings> in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk.

This is really confusing for users and we need to consider rephrasing or maybe removing it.

cc @joperezr @danmoseley @reyang

reyang commented 1 month ago

Thanks @xakep139!

In OpenTelemetry .NET, we recommend users to use Microsoft.Extensions.Telemetry.Abstractions for strongly typed complex object logging. Currently we have to set SuppressTfmSupportBuildWarnings=true and I've heard from users that they don't really know if it is expected to work in .NET framework, or it might stop working with any future version of Microsoft.Extensions.Telemetry.Abstractions, or it might occasionally fail due to some implementation details - in a nutshell, users don't understand the warning message and they tend to interpret it as "you cannot bet on it if you are on .NET Framework".

https://github.com/open-telemetry/opentelemetry-dotnet/blob/1bbafaa7b7bed6470ff52fc76b6e881cd19692a5/docs/logs/complex-objects/complex-objects.csproj#L3

noahfalk commented 1 month ago

This is really confusing for users and we need to consider rephrasing or maybe removing it.

If a 3rd party uses an extensions library, encounters an issue and reports it to Microsoft are the maintainers going to address it? If yes then it seems like the warning should be removed.

xakep139 commented 1 month ago

cc @joperezr