Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ObsoletedInOSPlatform attribute support in Platform Compat Analyzer #6082

Merged
merged 6 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/NetAnalyzers/Core/AnalyzerReleases.Unshipped.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Rule ID | Category | Severity | Notes
CA1311 | Globalization | Hidden | SpecifyCultureForToLowerAndToUpper, [Documentation](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1311)
CA1420 | Interoperability | Warning | FeatureUnsupportedWhenRuntimeMarshallingDisabled, [Documentation](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1420)
CA1421 | Interoperability | Info | MethodUsesRuntimeMarshallingEvenWhenMarshallingDisabled, [Documentation](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1421)
CA1422 | Interoperability | Warning | PlatformCompatibilityAnalyzer, [Documentation](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)
CA1849 | Performance | Disabled | UseAsyncMethodInAsyncContext, [Documentation](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1849)
CA1850 | Performance | Info | PreferHashDataOverComputeHashAnalyzer, [Documentation](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1850)
CA1851 | Performance | Disabled | AvoidMultipleEnumerations, [Documentation](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1851)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,24 @@ public sealed partial class PlatformCompatibilityAnalyzer
/// So we only keep at most 2 versions of [UnsupportedOSPlatform] first one will be the lowest version found, second one will be second lowest if there is any
///
/// Properties:
/// - ObsoletedIn - keeps lowest version of [ObsoletedInOSPlatform] attribute found
/// - SupportedFirst - keeps lowest version of [SupportedOSPlatform] attribute found
/// - SupportedSecond - keeps the highest version of [SupportedOSPlatform] attribute if there is any
/// - UnsupportedFirst - keeps the lowest version of [UnsupportedOSPlatform] attribute found
/// - UnsupportedSecond - keeps the second lowest version of [UnsupportedOSPlatform] attribute found
/// </summary>
private class Versions
{
public Version? ObsoletedIn { get; set; }
public string? ObsoletedMessage { get; set; }
public string? ObsoletedUrl { get; set; }
public Version? SupportedFirst { get; set; }
public Version? SupportedSecond { get; set; }
public Version? UnsupportedFirst { get; set; }
public string? UnsupportedMessage { get; set; }
public Version? UnsupportedSecond { get; set; }
public bool IsSet() => SupportedFirst != null || UnsupportedFirst != null ||
SupportedSecond != null || UnsupportedSecond != null;
SupportedSecond != null || UnsupportedSecond != null || ObsoletedIn != null;
}

private sealed class PlatformAttributes
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1948,4 +1948,15 @@
<data name="SpecifyIFormatProviderMessageIFormatProviderOptional" xml:space="preserve">
<value>The behavior of '{0}' could vary based on the current user's locale settings. Provide a value for the 'IFormatProvider' argument.</value>
</data>
<data name="PlatformCompatibilityObsoletedCsAllPlatformMessage" xml:space="preserve">
<value>This call site is reachable on all platforms. '{0}' is obsoleted on: {1}.</value>
<comment>This call site is reachable on all platforms. 'OboletedOnMacOS()' is obsoleted on: 'macos'.</comment>
</data>
<data name="PlatformCompatibilityObsoletedCsReachableMessage" xml:space="preserve">
<value>This call site is reachable on: {2}. '{0}' is obsoleted on: {1}.</value>
<comment>This call site is reachable on 'macos', 'linux'. 'OboletedOnMacOS()' is obsoleted on: 'macos'.</comment>
</data>
<data name="ParenthesisWithPlaceHolder" xml:space="preserve">
<value> ({0})</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">Metody P/Invoke nemají být viditelné</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">a všechny ostatní platformy</target>
Expand All @@ -1852,6 +1857,16 @@
<target state="translated">{0} od verze {1} do {2}</target>
<note>'SupportedOnWindows1903UnsupportedOn2004()' is supported on: 'windows' from version 10.0.1903 to 10.0.2004.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityObsoletedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is obsoleted on: {1}.</source>
<target state="new">This call site is reachable on all platforms. '{0}' is obsoleted on: {1}.</target>
<note>This call site is reachable on all platforms. 'OboletedOnMacOS()' is obsoleted on: 'macos'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityObsoletedCsReachableMessage">
<source>This call site is reachable on: {2}. '{0}' is obsoleted on: {1}.</source>
<target state="new">This call site is reachable on: {2}. '{0}' is obsoleted on: {1}.</target>
<note>This call site is reachable on 'macos', 'linux'. 'OboletedOnMacOS()' is obsoleted on: 'macos'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityOnlySupportedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is only supported on: {1}.</source>
<target state="translated">Toto místo volání je k dispozici na všech platformách. {0} se podporuje jen na {1}.</target>
Expand Down Expand Up @@ -1884,12 +1899,12 @@
</trans-unit>
<trans-unit id="PlatformCompatibilityUnsupportedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is unsupported on: {1}.</source>
<target state="translated">Toto místo volání je k dispozici na všech platformách. {0} se nepodporuje na {1}.</target>
<target state="new">This call site is reachable on all platforms. '{0}' is unsupported on: {1}.</target>
<note>This call site is reachable on all platforms. 'UnsupportedOnWindows()' is unsupported on: 'windows'</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityUnsupportedCsReachableMessage">
<source>This call site is reachable on: {2}. '{0}' is unsupported on: {1}.</source>
<target state="translated">Toto místo volání je k dispozici na {2}. {0} se nepodporuje na {1}.</target>
<target state="new">This call site is reachable on: {2}. '{0}' is unsupported on: {1}.</target>
<note>This call site is reachable on: 'windows', 'browser'. 'UnsupportedOnBrowser()' is unsupported on: 'browser'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityVersionAndBefore">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">P/Invokes dürfen nicht sichtbar sein</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">und alle anderen Plattformen</target>
Expand All @@ -1852,6 +1857,16 @@
<target state="translated">{0}, Version {1} bis {2}</target>
<note>'SupportedOnWindows1903UnsupportedOn2004()' is supported on: 'windows' from version 10.0.1903 to 10.0.2004.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityObsoletedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is obsoleted on: {1}.</source>
<target state="new">This call site is reachable on all platforms. '{0}' is obsoleted on: {1}.</target>
<note>This call site is reachable on all platforms. 'OboletedOnMacOS()' is obsoleted on: 'macos'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityObsoletedCsReachableMessage">
<source>This call site is reachable on: {2}. '{0}' is obsoleted on: {1}.</source>
<target state="new">This call site is reachable on: {2}. '{0}' is obsoleted on: {1}.</target>
<note>This call site is reachable on 'macos', 'linux'. 'OboletedOnMacOS()' is obsoleted on: 'macos'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityOnlySupportedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is only supported on: {1}.</source>
<target state="translated">Diese Aufrufsite ist auf allen Plattformen erreichbar. "{0}" nur unterstützt für: {1}.</target>
Expand Down Expand Up @@ -1884,12 +1899,12 @@
</trans-unit>
<trans-unit id="PlatformCompatibilityUnsupportedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is unsupported on: {1}.</source>
<target state="translated">Diese Aufrufsite ist auf allen Plattformen erreichbar. "{0}" nicht unterstützt für: {1}.</target>
<target state="new">This call site is reachable on all platforms. '{0}' is unsupported on: {1}.</target>
<note>This call site is reachable on all platforms. 'UnsupportedOnWindows()' is unsupported on: 'windows'</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityUnsupportedCsReachableMessage">
<source>This call site is reachable on: {2}. '{0}' is unsupported on: {1}.</source>
<target state="translated">Diese Aufrufsite ist erreichbar für: {2}. "{0}" nicht unterstützt für: {1}.</target>
<target state="new">This call site is reachable on: {2}. '{0}' is unsupported on: {1}.</target>
<note>This call site is reachable on: 'windows', 'browser'. 'UnsupportedOnBrowser()' is unsupported on: 'browser'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityVersionAndBefore">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">Los elementos P/Invoke no deben estar visibles</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">y el resto de plataformas</target>
Expand All @@ -1852,6 +1857,16 @@
<target state="translated">"{0}" de la versión {1} a la {2}</target>
<note>'SupportedOnWindows1903UnsupportedOn2004()' is supported on: 'windows' from version 10.0.1903 to 10.0.2004.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityObsoletedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is obsoleted on: {1}.</source>
<target state="new">This call site is reachable on all platforms. '{0}' is obsoleted on: {1}.</target>
<note>This call site is reachable on all platforms. 'OboletedOnMacOS()' is obsoleted on: 'macos'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityObsoletedCsReachableMessage">
<source>This call site is reachable on: {2}. '{0}' is obsoleted on: {1}.</source>
<target state="new">This call site is reachable on: {2}. '{0}' is obsoleted on: {1}.</target>
<note>This call site is reachable on 'macos', 'linux'. 'OboletedOnMacOS()' is obsoleted on: 'macos'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityOnlySupportedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is only supported on: {1}.</source>
<target state="translated">Se puede acceder a este sitio de llamada en todas las plataformas. "{0}" solo se admite en {1}.</target>
Expand Down Expand Up @@ -1884,12 +1899,12 @@
</trans-unit>
<trans-unit id="PlatformCompatibilityUnsupportedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is unsupported on: {1}.</source>
<target state="translated">Se puede acceder a este sitio de llamada en todas las plataformas. "{0}" no se admite en {1}.</target>
<target state="new">This call site is reachable on all platforms. '{0}' is unsupported on: {1}.</target>
<note>This call site is reachable on all platforms. 'UnsupportedOnWindows()' is unsupported on: 'windows'</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityUnsupportedCsReachableMessage">
<source>This call site is reachable on: {2}. '{0}' is unsupported on: {1}.</source>
<target state="translated">Se puede acceder a este sitio de llamada en {2}. "{0}" no se admite en {1}.</target>
<target state="new">This call site is reachable on: {2}. '{0}' is unsupported on: {1}.</target>
<note>This call site is reachable on: 'windows', 'browser'. 'UnsupportedOnBrowser()' is unsupported on: 'browser'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityVersionAndBefore">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">Les P/Invoke ne doivent pas être visibles</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">et toutes les autres plateformes</target>
Expand All @@ -1852,6 +1857,16 @@
<target state="translated">'{0}' de la version {1} à {2}</target>
<note>'SupportedOnWindows1903UnsupportedOn2004()' is supported on: 'windows' from version 10.0.1903 to 10.0.2004.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityObsoletedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is obsoleted on: {1}.</source>
<target state="new">This call site is reachable on all platforms. '{0}' is obsoleted on: {1}.</target>
<note>This call site is reachable on all platforms. 'OboletedOnMacOS()' is obsoleted on: 'macos'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityObsoletedCsReachableMessage">
<source>This call site is reachable on: {2}. '{0}' is obsoleted on: {1}.</source>
<target state="new">This call site is reachable on: {2}. '{0}' is obsoleted on: {1}.</target>
<note>This call site is reachable on 'macos', 'linux'. 'OboletedOnMacOS()' is obsoleted on: 'macos'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityOnlySupportedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is only supported on: {1}.</source>
<target state="translated">Ce site d'appel est accessible sur toutes les plateformes. '{0}' est uniquement pris en charge sur {1}.</target>
Expand Down Expand Up @@ -1884,12 +1899,12 @@
</trans-unit>
<trans-unit id="PlatformCompatibilityUnsupportedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is unsupported on: {1}.</source>
<target state="translated">Ce site d'appel est accessible sur toutes les plateformes. '{0}' n'est pas pris en charge sur {1}.</target>
<target state="new">This call site is reachable on all platforms. '{0}' is unsupported on: {1}.</target>
<note>This call site is reachable on all platforms. 'UnsupportedOnWindows()' is unsupported on: 'windows'</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityUnsupportedCsReachableMessage">
<source>This call site is reachable on: {2}. '{0}' is unsupported on: {1}.</source>
<target state="translated">Ce site d'appel est accessible sur {2}. '{0}' n'est pas pris en charge sur {1}.</target>
<target state="new">This call site is reachable on: {2}. '{0}' is unsupported on: {1}.</target>
<note>This call site is reachable on: 'windows', 'browser'. 'UnsupportedOnBrowser()' is unsupported on: 'browser'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityVersionAndBefore">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">I metodi P/Invoke non devono essere visibili</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">e tutte le altre piattaforme</target>
Expand All @@ -1852,6 +1857,16 @@
<target state="translated">'{0}' dalla versione {1} alla versione {2}</target>
<note>'SupportedOnWindows1903UnsupportedOn2004()' is supported on: 'windows' from version 10.0.1903 to 10.0.2004.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityObsoletedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is obsoleted on: {1}.</source>
<target state="new">This call site is reachable on all platforms. '{0}' is obsoleted on: {1}.</target>
<note>This call site is reachable on all platforms. 'OboletedOnMacOS()' is obsoleted on: 'macos'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityObsoletedCsReachableMessage">
<source>This call site is reachable on: {2}. '{0}' is obsoleted on: {1}.</source>
<target state="new">This call site is reachable on: {2}. '{0}' is obsoleted on: {1}.</target>
<note>This call site is reachable on 'macos', 'linux'. 'OboletedOnMacOS()' is obsoleted on: 'macos'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityOnlySupportedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is only supported on: {1}.</source>
<target state="translated">Questo sito di chiamata è raggiungibile da tutte le piattaforme. '{0}' è supportato solo in {1}.</target>
Expand Down Expand Up @@ -1884,12 +1899,12 @@
</trans-unit>
<trans-unit id="PlatformCompatibilityUnsupportedCsAllPlatformMessage">
<source>This call site is reachable on all platforms. '{0}' is unsupported on: {1}.</source>
<target state="translated">Questo sito di chiamata è raggiungibile da tutte le piattaforme. '{0}' non è supportato in {1}.</target>
<target state="new">This call site is reachable on all platforms. '{0}' is unsupported on: {1}.</target>
<note>This call site is reachable on all platforms. 'UnsupportedOnWindows()' is unsupported on: 'windows'</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityUnsupportedCsReachableMessage">
<source>This call site is reachable on: {2}. '{0}' is unsupported on: {1}.</source>
<target state="translated">Questo sito di chiamata è raggiungibile da {2}. '{0}' non è supportato in {1}.</target>
<target state="new">This call site is reachable on: {2}. '{0}' is unsupported on: {1}.</target>
<note>This call site is reachable on: 'windows', 'browser'. 'UnsupportedOnBrowser()' is unsupported on: 'browser'.</note>
</trans-unit>
<trans-unit id="PlatformCompatibilityVersionAndBefore">
Expand Down
Loading