Skip to content

Missing [un]supported APIs annotations in System.Net.NetworkInformation #51301

Closed

Description

@marek-safar

System.Net.NetworkInformation assembly on platforms where it's supported has over 80 PNSE methods but no [un]supported APIs annotation. This degrades user experience when working with the APIs as a significant portion of the assembly is not supported cross-platform.

It should be part of #47228

/cc @jeffhandley @buyaa-n

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Apr 15, 2021
  2. marek-safar commented on Apr 20, 2021

    @marek-safar
    ContributorAuthor

    @buyaa-n any thoughts on why your tool didn't find these?

  3. buyaa-n commented on Apr 20, 2021

    @buyaa-n
    Contributor

    I run the tool only for cross-platform builds, seems for System.Net.NetworkInformation there is no source built for cross-platform (or when Condition="'$(TargetsAnyOS)' != 'true'") that is why there is nothing detected. From the existing TFMs seems it is supported on windows; Linux; OSX; iOS; tvOS; FreeBSD; illumos; Solaris; so we can add those platforms into the assembly level supported list. If you are expecting individual APIs supposed to be annotated then i have not detected them for now, I am updating the tool to detect incompatible PNSEs in targeted builds, almost finished then, need to run it and analyze the results.

  4. added this to the 6.0.0 milestone on Apr 22, 2021
  5. removed
    untriagedNew issue has not been triaged by the area owner
    on Apr 22, 2021
  6. karelz commented on May 6, 2021

    @karelz
    Member

    @buyaa-n assigning to you as you are working on the tool update. Is there any ETA or work item tracking it on Analyzer side?

  7. buyaa-n commented on May 6, 2021

    @buyaa-n
    Contributor

    Is there any ETA or work item tracking it on Analyzer side?

    The issue for adding the analyzer is closed in API review as adding it in SKD or runtime repo will be very noisy, so the analyzer I am running is only for one-time detection. But there is a related issue for detecting unsupported APIs and annotating them

  8. karelz commented on Jun 25, 2021

    @karelz
    Member

    @buyaa-n @jeffhandley is it still on your radar for 6.0? (just double checking it was not forgotten as it is in Networking area ...)

  9. karelz commented on Jun 30, 2021

    @karelz
    Member
  10. jeffhandley commented on Jul 8, 2021

    @jeffhandley
    Member

    @karelz This is still on our radar, but we're not going to be able to look at it again before the Preview 7 snap; we'll have to follow up before RC1.

  11. buyaa-n commented on Jul 24, 2021

    @buyaa-n
    Contributor

    Somehow when running build from runtime root folder no warnings logged for this project. But i still see plenty of PNSEs with manual search, so run the build from the project src folder and see the warnings. There is 2 public APIs needs UnsupportedOSPlatform annotation for specific platforms (top 2 rows), and 71 APIs defined in internal class and doesn't seem to have any reference internally (remaining rows). (Did not check all but all i have checked has not referenced). I am not sure what to do with them, so i will leave them up to the area owners. Also seems the project is only supported on specific platforms and throws on all other, probably we want to add project level SupportedOSPlatform attribute for each support. So here is the list of APIs (might) need annotation:

    API Comment Suggestion Location
    'NetworkChange.NetworkAddressChanged' unconditionally throws PNSE, reachable on illumos, Solaris Add unsupported for each platform, public API NetworkInformation\NetworkAddressChange.UnknownUnix.cs(22,19)
    'NetworkChange.NetworkAvailabilityChanged' unconditionally throws PNSE, reachable on Solaris, illumos Add unsupported for each platform, public API NetworkInformation\NetworkAddressChange.UnknownUnix.cs(29,22)
    'BsdIcmpV4Statistics.ErrorsReceived' unconditionally throws PNSE, reachable on tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIcmpV4Statistics.cs(83,53)
    'BsdIcmpV4Statistics.ErrorsSent' unconditionally throws PNSE, reachable on tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIcmpV4Statistics.cs(85,49)
    'BsdIcmpV4Statistics.MessagesReceived' unconditionally throws PNSE, reachable on tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIcmpV4Statistics.cs(87,55)
    'BsdIcmpV4Statistics.MessagesSent' unconditionally throws PNSE, reachable on tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIcmpV4Statistics.cs(89,51)
    'BsdIcmpV6Statistics.ErrorsReceived' unconditionally throws PNSE, reachable on tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIcmpV6Statistics.cs(87,53)
    'BsdIcmpV6Statistics.ErrorsSent' unconditionally throws PNSE, reachable on tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIcmpV6Statistics.cs(89,49)
    'BsdIcmpV6Statistics.MessagesReceived' unconditionally throws PNSE, reachable on tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIcmpV6Statistics.cs(91,55)
    'BsdIcmpV6Statistics.MessagesSent' unconditionally throws PNSE, reachable on tvOS Maybe add unsupported for each platform, internal class NetworkInformation\BsdIcmpV6Statistics.cs(93,51)
    'BsdIPGlobalProperties.GetIPv6GlobalStatistics()' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIPGlobalProperties.cs(142,13)
    'BsdIpInterfaceProperties.AnycastAddresses' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIpInterfaceProperties.cs(23,81)
    'BsdIpInterfaceProperties.DhcpServerAddresses' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIpInterfaceProperties.cs(25,73)
    'BsdIpInterfaceProperties.IsDnsEnabled' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIpInterfaceProperties.cs(29,51)
    'BsdIpInterfaceProperties.IsDynamicDnsEnabled' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIpInterfaceProperties.cs(31,58)
    'BsdIpInterfaceProperties.WinsServersAddresses' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIpInterfaceProperties.cs(33,74)
    'BsdIpInterfaceStatistics.OutgoingPacketsDiscarded' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIpInterfaceStatistics.cs(55,63)
    'BsdIPv4GlobalStatistics.OutputPacketsDiscarded' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIPv4GlobalStatistics.cs(100,61)
    'BsdIPv4GlobalStatistics.PacketFragmentFailures' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIPv4GlobalStatistics.cs(104,61)
    'BsdIPv4GlobalStatistics.PacketReassembliesRequired' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIPv4GlobalStatistics.cs(106,65)
    'BsdIPv4GlobalStatistics.PacketReassemblyTimeout' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIPv4GlobalStatistics.cs(110,62)
    'BsdIPv4GlobalStatistics.OutputPacketRoutingDiscards' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIPv4GlobalStatistics.cs(98,66)
    'BsdIPv4InterfaceProperties.IsAutomaticPrivateAddressingActive' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIPv4InterfaceProperties.cs(16,73)
    'BsdIPv4InterfaceProperties.IsAutomaticPrivateAddressingEnabled' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIPv4InterfaceProperties.cs(18,74)
    'BsdIPv4InterfaceProperties.IsDhcpEnabled' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIPv4InterfaceProperties.cs(20,52)
    'BsdIPv4InterfaceProperties.IsForwardingEnabled' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIPv4InterfaceProperties.cs(23,58)
    'BsdIPv4InterfaceProperties.UsesWins' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIPv4InterfaceProperties.cs(27,47)
    'BsdIPv6InterfaceProperties.GetScopeId(ScopeLevel)' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdIPv6InterfaceProperties.cs(20,13)
    'BsdTcpStatistics.MaximumConnections' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdTcpStatistics.cs(49,57)
    'BsdTcpStatistics.MaximumTransmissionTimeout' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdTcpStatistics.cs(51,65)
    'BsdTcpStatistics.MinimumTransmissionTimeout' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdTcpStatistics.cs(53,65)
    'BsdTcpStatistics.ResetConnections' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdTcpStatistics.cs(55,55)
    'BsdTcpStatistics.ResetsSent' unconditionally throws PNSE, reachable on  tvOS, iOS, FreeBSD, OSX Maybe add unsupported for each platform, internal class NetworkInformation\BsdTcpStatistics.cs(57,49)
    'IPGlobalPropertiesPal.GetIPGlobalProperties()' unconditionally throws PNSE, reachable on illumos, Solaris Maybe add unsupported for each platform, internal class NetworkInformation\IPGlobalPropertiesPal.UnknownUnix.cs(10,13)
    'LinuxIPAddressInformation.IsDnsEligible' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxIPAddressInformation.cs(17,52)
    'LinuxIPAddressInformation.IsTransient' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxIPAddressInformation.cs(19,50)
    'LinuxIPGlobalStatistics.OutputPacketRoutingDiscards' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxIPGlobalStatistics.cs(59,66)
    'LinuxIPInterfaceProperties.IsDynamicDnsEnabled' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxIPInterfaceProperties.cs(31,58)
    'LinuxIPInterfaceProperties.AnycastAddresses' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxIPInterfaceProperties.cs(33,81)
    'LinuxIPInterfaceStatistics.IncomingUnknownProtocolPackets' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxIPInterfaceStatistics.cs(38,69)
    'LinuxIPInterfaceStatistics.NonUnicastPacketsSent' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxIPInterfaceStatistics.cs(42,60)
    'LinuxIPv4InterfaceProperties.IsAutomaticPrivateAddressingActive' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxIPv4InterfaceProperties.cs(20,73)
    'LinuxIPv4InterfaceProperties.IsAutomaticPrivateAddressingEnabled' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxIPv4InterfaceProperties.cs(22,74)
    'LinuxIPv4InterfaceProperties.IsDhcpEnabled' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxIPv4InterfaceProperties.cs(24,52)
    'LinuxTcpStatistics.ConnectionsAccepted' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxTcpStatistics.cs(21,58)
    'LinuxTcpStatistics.ConnectionsInitiated' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxTcpStatistics.cs(23,59)
    'LinuxTcpStatistics.CumulativeConnections' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxTcpStatistics.cs(25,60)
    'LinuxTcpStatistics.MaximumTransmissionTimeout' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxTcpStatistics.cs(35,65)
    'LinuxTcpStatistics.MinimumTransmissionTimeout' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxTcpStatistics.cs(37,65)
    'LinuxTcpStatistics.ResetsSent' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxTcpStatistics.cs(41,49)
    'LinuxUdpStatistics.IncomingDatagramsDiscarded' unconditionally throws PNSE, reachable on Linux Maybe add unsupported for each platform, internal class NetworkInformation\LinuxUdpStatistics.cs(31,65)
    'NetworkInterfacePal.GetAllNetworkInterfaces()' unconditionally throws PNSE, reachable on illumos, Solaris Maybe add unsupported for each platform, internal class NetworkInformation\NetworkInterfacePal.UnknownUnix.cs(11,13)
    'NetworkInterfacePal.GetIsNetworkAvailable()' unconditionally throws PNSE, reachable on illumos, Solaris Maybe add unsupported for each platform, internal class NetworkInformation\NetworkInterfacePal.UnknownUnix.cs(16,13)
    'NetworkInterfacePal.IPv6LoopbackInterfaceIndex' unconditionally throws PNSE, reachable on illumos, Solaris Maybe add unsupported for each platform, internal class NetworkInformation\NetworkInterfacePal.UnknownUnix.cs(21,19)
    'NetworkInterfacePal.LoopbackInterfaceIndex' unconditionally throws PNSE, reachable on illumos, Solaris Maybe add unsupported for each platform, internal class NetworkInformation\NetworkInterfacePal.UnknownUnix.cs(26,19)
    'UnixIPGlobalProperties.DhcpScopeName' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal abstract class NetworkInformation\UnixIPGlobalProperties.cs(14,54)
    'UnixIPGlobalProperties.IsWinsProxy' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal abstract class NetworkInformation\UnixIPGlobalProperties.cs(20,50)
    'UnixMulticastIPAddressInformation.IsDnsEligible' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixMulticastIPAddressInformation.cs(17,52)
    'UnixMulticastIPAddressInformation.IsTransient' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixMulticastIPAddressInformation.cs(19,50)
    'UnixMulticastIPAddressInformation.AddressPreferredLifetime' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixMulticastIPAddressInformation.cs(21,63)
    'UnixMulticastIPAddressInformation.AddressValidLifetime' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixMulticastIPAddressInformation.cs(23,59)
    'UnixMulticastIPAddressInformation.DhcpLeaseLifetime' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixMulticastIPAddressInformation.cs(25,56)
    'UnixMulticastIPAddressInformation.DuplicateAddressDetectionState' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixMulticastIPAddressInformation.cs(27,95)
    'UnixMulticastIPAddressInformation.PrefixOrigin' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixMulticastIPAddressInformation.cs(29,59)
    'UnixMulticastIPAddressInformation.SuffixOrigin' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixMulticastIPAddressInformation.cs(31,59)
    'UnixUnicastIPAddressInformation.IsDnsEligible' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixUnicastIPAddressInformation.cs(22,52)
    'UnixUnicastIPAddressInformation.IsTransient' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixUnicastIPAddressInformation.cs(25,50)
    'UnixUnicastIPAddressInformation.AddressPreferredLifetime' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixUnicastIPAddressInformation.cs(28,63)
    'UnixUnicastIPAddressInformation.AddressValidLifetime' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixUnicastIPAddressInformation.cs(31,59)
    'UnixUnicastIPAddressInformation.DhcpLeaseLifetime' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixUnicastIPAddressInformation.cs(34,56)
    'UnixUnicastIPAddressInformation.DuplicateAddressDetectionState' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixUnicastIPAddressInformation.cs(37,95)
    'UnixUnicastIPAddressInformation.PrefixOrigin' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixUnicastIPAddressInformation.cs(39,59)
    'UnixUnicastIPAddressInformation.SuffixOrigin' unconditionally throws PNSE, reachable on illumos, Solaris, tvOS, iOS, FreeBSD, Linux, OSX Maybe add unsupported for each platform, internal class NetworkInformation\UnixUnicastIPAddressInformation.cs(42,59)

    CC @karelz @marek-safar @jeffhandley @ManickaP

  12. self-assigned this
    on Aug 5, 2021
  13. ManickaP commented on Aug 11, 2021

    @ManickaP
    Member

    Hi @buyaa-n, can I ran the tool locally on my own? If so, than how? I'd like to make sure that my change gets rid of of these issues.

  14. ManickaP commented on Aug 11, 2021

    @ManickaP
    Member

    So I'm hitting an issue that illumos and solaris are unknown:

    /home/manicka/repositories/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.UnknownUnix.cs(22,10): error CA1418: The platform 'Solaris' is not a known platform name [/home/manicka/repositories/runtime/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj]
    /home/manicka/repositories/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.UnknownUnix.cs(21,10): error CA1418: The platform 'illumos' is not a known platform name [/home/manicka/repositories/runtime/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj]
    

    I see in #49323 (comment):

    • The platform 'illumos' is not a known platform name
    • What do you recommend for this one, @buyaa-n?

    Nothing except disabling it for generated files 😛

    So what's the guideline here @buyaa-n ?

    Note that using SupportedOS doesn't help here either since that would be UnknownUnix which has the same problem as the two OSes above.

  15. buyaa-n commented on Aug 11, 2021

    @buyaa-n
    Contributor

    I'd like to make sure that my change gets rid of these issues.

    Thanks, that is not necessary, but if you still want to do it i can give you the analyzer's dll which you can replace with your local NuGet copy and run the build

  16. buyaa-n commented on Aug 11, 2021

    @buyaa-n
    Contributor

    Note that using SupportedOS doesn't help here either since that would be UnknownUnix which has the same problem as the two OSes above.

    Not sure why do you think the <SupportedPlatform> hook would not work and what is UnknownUnix? Did already you tried adding <SupportedPlatform Include="illumos"/> and <SupportedPlatform Include="solaris "/> (might need to add them conditional so that it is not added in unnecessary builds)

    Another thing you might want to consider is if the API is only supported on certain platforms better to add SupportedOSPlatform attribute(s) instead of UnsupportedOSPlatform attribute(s)

  17. ManickaP commented on Aug 11, 2021

    @ManickaP
    Member

    better to add SupportedOSPlatform attribute(s) instead of UnsupportedOSPlatform attribute(s)

    That's what I've meant with "using SupportedOS doesn't help here either", because the file is conditionally compiled for these 3 platforms: UknownUnix, Solaris, illumos:

    <ItemGroup Condition="'$(TargetsUnknownUnix)' == 'true' or '$(Targetsillumos)' == 'true' or '$(TargetsSolaris)' == 'true'">
    <Compile Include="System\Net\NetworkInformation\IPGlobalPropertiesPal.UnknownUnix.cs" />
    <Compile Include="System\Net\NetworkInformation\NetworkInterfacePal.UnknownUnix.cs" />
    <Compile Include="System\Net\NetworkInformation\NetworkAddressChange.UnknownUnix.cs" />
    </ItemGroup>

    Neither of those strings works with SupportedOSPlatform/UnsupportedOSPlatform. So reversing the condition doesn't help here.

    Did already you tried adding and (might need to add them conditional so that it is not added in unnecessary builds)

    What is that? Do we have an example of this? I've never heard or seen this.

  18. buyaa-n commented on Aug 11, 2021

    @buyaa-n
    Contributor

    Neither of those strings works with SupportedOSPlatform/UnsupportedOSPlatform. So reversing the condition doesn't help here.

    I see, with Note that using SupportedOS doesn't help i thought you are talking about <SupportedPlatform Include="illumos"/> and <SupportedPlatform Include="solaris "/> properties

    What is that? Do we have an example of this? I've never heard or seen this.

    It is a used to add unknown platforms to the MSBuild SupportedPlatforms list, you can add <SupportedPlatform Include="illumos"/> and <SupportedPlatform Include="solaris "/> item group in your project. Probably with a condition Condition="'$(TargetsUnknownUnix)' == 'true'"

    <ItemGroup>
      <SupportedPlatform Condition="'$(TargetsUnknownUnix)' == 'true'" Include="illumos"/>
      <SupportedPlatform Condition="'$(TargetsUnknownUnix)' == 'true'" Include="solaris "/>
    </ItemGroup>
  19. ManickaP commented on Aug 12, 2021

    @ManickaP
    Member

    Thanks, that is not necessary, but if you still want to do it i can give you the analyzer's dll which you can replace with your local NuGet copy and run the build

    Please, could you send me the dll? I don't see any difference with or without my change, so it's really hard for me to know if I'm actually fixing anything.

    BTW, the <SupportedPlatform ...> helped so thanks for that 👍

  20. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Aug 12, 2021
  21. buyaa-n commented on Aug 13, 2021

    @buyaa-n
    Contributor

    Please, could you send me the dll? I don't see any difference with or without my change, so it's really hard for me to know if I'm actually fixing anything.

    JFYI: the analyzer is not perfect it could produce lots of false positives (have fixed some false positives recently, but still you could see some, though do not remember if and how many false positives the System.Net.NetworkInformation had). Anyway will send the dll via email, meanwhile, the source is here if you want to take a look

  22. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Aug 17, 2021
  23. ghost locked as resolved and limited conversation to collaborators on Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions