Posted 27 March 2024, 8:51 pm EST
Hi C1,
after updating C1Schedule to .643, this warning is reported in our projects referencing C1Schedule:
warning CA1416: This call site is reachable on: ‘windows’ all versions. ‘…’ is only supported on: ‘windows’ 6.1 and later. (https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
I could reproduce it with attached sample:
ScheduleTest.zip
With .636 it works, which makes me think that it is related to C1 somehow ;-).
We switch off this warning in “AssemblyInfo.cs” previously:
[assembly: System.Runtime.Versioning.SupportedOSPlatform("windows")]
But this does not work with the newest version.
It seems to happen only because we use “global.json” to force the SDK version to 6.0:
{
"sdk": {
"version": "6.0.0",
"rollForward": "latestFeature"
}
}
If I enter “7.0.0” in this file, the warning disappears also. So it might also be a bug in the SDK. But I want to stay with the SDK matching our target framework version - don’t know whether it could cause issues to switch the SDK version to 8.0.0.
I found two workarounds:
Workaround 1:
Define the “SupportedOSPlatform” like this:
[assembly: System.Runtime.Versioning.SupportedOSPlatform("windows6.1")]
Workaround 2:
Suppress the warning:
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")]
Do you have any idea on this? Is it related to some change in version .643?
Best regards
Wolfgang
Note: I will be on vacation for the next three weeks, but will check my mails occasionally, so replies might be delayed.