serilog / serilog-sinks-xamarin

A Serilog sink that writes events to Xamarin mobile targets
Apache License 2.0
55 stars 18 forks source link

warning CA1416: This call ... is only supported on: 'Android' 31.0 / 'iOS' 15.4 and later. #29

Closed tranb3r closed 1 year ago

tranb3r commented 1 year ago

Bug report

When building a maui app referencing Serilog.Sinks.Xamarin 1.0.0, I get the following warnings:

warning CA1416: This call site is reachable on: 'iOS' 15.0 and later, 'maccatalyst' 15.0 and later. 'LoggerConfigurationXamarinExtensions.NSLog(LoggerSinkConfiguration, LogEventLevel, string, IFormatProvider)' is only supported on: 'iOS' 15.4 and later
warning CA1416: This call site is reachable on: 'Android' 21.0 and later. 'LoggerConfigurationXamarinExtensions.AndroidLog(LoggerSinkConfiguration, LogEventLevel, string, IFormatProvider)' is only supported on: 'Android' 31.0 and later

Indeed, here are the supported platform versions as visible in the Serilog.Sinks.Xamarin 1.0.0 nuget's assemblies:

[assembly: SupportedOSPlatform("Android31.0")]
[assembly: SupportedOSPlatform("iOS15.4")]

The reason for it is that serilog-sinks-xamarin is missing SupportedOSPlatformVersion in its csproj:

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>

Could you please fix that and publish a new version of the nuget ? Thanks

tranb3r commented 1 year ago

I don't know why, but this is not happening anymore.