diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.Data.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.Data.cs index 634f3e0de2..c42312abe5 100644 --- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.Data.cs +++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.Data.cs @@ -26,7 +26,7 @@ public sealed partial class PlatformCompatibilityAnalyzer /// private class Versions { - public Version? ObsoletedIn { get; set; } + public Version? Obsoleted { get; set; } public string? ObsoletedMessage { get; set; } public string? ObsoletedUrl { get; set; } public Version? SupportedFirst { get; set; } @@ -35,7 +35,7 @@ private class Versions public string? UnsupportedMessage { get; set; } public Version? UnsupportedSecond { get; set; } public bool IsSet() => SupportedFirst != null || UnsupportedFirst != null || - SupportedSecond != null || UnsupportedSecond != null || ObsoletedIn != null; + SupportedSecond != null || UnsupportedSecond != null || Obsoleted != null; } private sealed class PlatformAttributes diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs index 0f35ce425d..d2c7e69f45 100644 --- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs +++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs @@ -35,14 +35,14 @@ public sealed partial class PlatformCompatibilityAnalyzer : DiagnosticAnalyzer { internal const string SupportRuleId = "CA1416"; internal const string ObsoletedRuleId = "CA1422"; - private static readonly ImmutableArray s_osPlatformAttributes = ImmutableArray.Create(SupportedOSPlatformAttribute, UnsupportedOSPlatformAttribute, ObsoletedInOSPlatformAttribute); + private static readonly ImmutableArray s_osPlatformAttributes = ImmutableArray.Create(SupportedOSPlatformAttribute, UnsupportedOSPlatformAttribute, ObsoletedOSPlatformAttribute); private static readonly LocalizableString s_localizableTitle = CreateLocalizableResourceString(nameof(PlatformCompatibilityTitle)); private static readonly LocalizableString s_localizableDescription = CreateLocalizableResourceString(nameof(PlatformCompatibilityDescription)); // We are adding the new attributes into older versions of .Net 5.0, so there could be multiple referenced assemblies each with their own // version of internal attribute type which will cause ambiguity, to avoid that we are comparing the attributes by their name - private const string ObsoletedInOSPlatformAttribute = nameof(ObsoletedInOSPlatformAttribute); + private const string ObsoletedOSPlatformAttribute = nameof(ObsoletedOSPlatformAttribute); private const string SupportedOSPlatformAttribute = nameof(SupportedOSPlatformAttribute); private const string UnsupportedOSPlatformAttribute = nameof(UnsupportedOSPlatformAttribute); private const string UnsupportedOSPlatformGuardAttribute = nameof(UnsupportedOSPlatformGuardAttribute); @@ -528,10 +528,10 @@ static bool IsKnownValueGuarded( attribute.UnsupportedSecond = null; } - if (attribute.ObsoletedIn != null && - attribute.ObsoletedIn.IsGreaterThanOrEqualTo(info.Version)) + if (attribute.Obsoleted != null && + attribute.Obsoleted.IsGreaterThanOrEqualTo(info.Version)) { - attribute.ObsoletedIn = null; + attribute.Obsoleted = null; attribute.ObsoletedMessage = null; attribute.ObsoletedUrl = null; } @@ -752,7 +752,7 @@ static void RemoveUnsupportsOnDifferentPlatforms(SmallDictionary attributes, } } - AddObsoletedIn(csAttributes, obsoletedBuilder, pName, pAttribute); + AddObsoleted(csAttributes, obsoletedBuilder, pName, pAttribute); } obsoletedPlatforms = obsoletedBuilder.ToImmutable(); @@ -1058,7 +1058,7 @@ static bool GetPlatformNames(SmallDictionary attributes, Small } } - AddObsoletedIn(csAttributes, obsoletedBuilder, pName, pAttribute); + AddObsoleted(csAttributes, obsoletedBuilder, pName, pAttribute); } obsoletedPlatforms = obsoletedBuilder.ToImmutable(); @@ -1067,11 +1067,11 @@ static bool GetPlatformNames(SmallDictionary attributes, Small } } - static void AddObsoletedIn(SmallDictionary? csAttributes, ArrayBuilder obsoletedBuilder, string pName, Versions pAttribute) + static void AddObsoleted(SmallDictionary? csAttributes, ArrayBuilder obsoletedBuilder, string pName, Versions pAttribute) { - if (pAttribute.ObsoletedIn != null) + if (pAttribute.Obsoleted != null) { - if (IsEmptyVersion(pAttribute.ObsoletedIn)) // Do not need to add the version part if it is 0.0 + if (IsEmptyVersion(pAttribute.Obsoleted)) // Do not need to add the version part if it is 0.0 { if (csAttributes != null && HasVersionedCallsite(csAttributes, pName)) { @@ -1084,7 +1084,7 @@ static void AddObsoletedIn(SmallDictionary? csAttributes, Arra } else { - obsoletedBuilder.Add(AppendMessageAndUrl(pAttribute, GetFormattedString(PlatformCompatibilityVersionAndLater, pName, pAttribute.ObsoletedIn))); + obsoletedBuilder.Add(AppendMessageAndUrl(pAttribute, GetFormattedString(PlatformCompatibilityVersionAndLater, pName, pAttribute.Obsoleted))); } } } @@ -1221,7 +1221,7 @@ static bool HasVersionedCallsite(SmallDictionary csAttributes, { if (csAttributes.TryGetValue(pName, out var attribute)) { - var version = attribute.ObsoletedIn; + var version = attribute.Obsoleted; var supportedVersion = attribute.SupportedSecond ?? attribute.SupportedFirst; if (supportedVersion != null) { @@ -1596,25 +1596,25 @@ private static bool IsNotSuppressedByCallSite(SmallDictionary } // Check if obsoleted attribute guarded by callsite attributes - if (attribute.ObsoletedIn != null) + if (attribute.Obsoleted != null) { if (callSiteAttributes.TryGetValue(platformName, out var callSiteAttribute)) { if (callSiteAttribute.SupportedFirst != null) { - if ((callSiteAttribute.ObsoletedIn == null || callSiteAttribute.ObsoletedIn > attribute.ObsoletedIn) && - (callSiteAttribute.UnsupportedFirst == null || callSiteAttribute.UnsupportedFirst > attribute.ObsoletedIn)) + if ((callSiteAttribute.Obsoleted == null || callSiteAttribute.Obsoleted > attribute.Obsoleted) && + (callSiteAttribute.UnsupportedFirst == null || callSiteAttribute.UnsupportedFirst > attribute.Obsoleted)) { - diagnosticAttribute.ObsoletedIn = (Version)attribute.ObsoletedIn.Clone(); + diagnosticAttribute.Obsoleted = (Version)attribute.Obsoleted.Clone(); diagnosticAttribute.ObsoletedMessage = attribute.ObsoletedMessage; diagnosticAttribute.ObsoletedUrl = attribute.ObsoletedUrl; } } else if (msBuildPlatforms.Contains(platformName, StringComparer.OrdinalIgnoreCase) && - (callSiteAttribute.UnsupportedFirst != null && callSiteAttribute.UnsupportedFirst > attribute.ObsoletedIn || - callSiteAttribute.ObsoletedIn != null && callSiteAttribute.ObsoletedIn > attribute.ObsoletedIn)) + (callSiteAttribute.UnsupportedFirst != null && callSiteAttribute.UnsupportedFirst > attribute.Obsoleted || + callSiteAttribute.Obsoleted != null && callSiteAttribute.Obsoleted > attribute.Obsoleted)) { - diagnosticAttribute.ObsoletedIn = (Version)attribute.ObsoletedIn.Clone(); + diagnosticAttribute.Obsoleted = (Version)attribute.Obsoleted.Clone(); diagnosticAttribute.ObsoletedMessage = attribute.ObsoletedMessage; diagnosticAttribute.ObsoletedUrl = attribute.ObsoletedUrl; } @@ -1622,7 +1622,7 @@ private static bool IsNotSuppressedByCallSite(SmallDictionary else if (msBuildPlatforms.Contains(platformName, StringComparer.OrdinalIgnoreCase) && !callSiteAttributes.Values.Any(AllowList)) { - diagnosticAttribute.ObsoletedIn = (Version)attribute.ObsoletedIn.Clone(); + diagnosticAttribute.Obsoleted = (Version)attribute.Obsoleted.Clone(); diagnosticAttribute.ObsoletedMessage = attribute.ObsoletedMessage; diagnosticAttribute.ObsoletedUrl = attribute.ObsoletedUrl; } @@ -1716,7 +1716,7 @@ private static Versions CopyAllAttributes(Versions copyTo, Versions copyFrom) copyTo.UnsupportedFirst = (Version?)copyFrom.UnsupportedFirst?.Clone(); copyTo.UnsupportedSecond = (Version?)copyFrom.UnsupportedSecond?.Clone(); copyTo.UnsupportedMessage = copyFrom.UnsupportedMessage; - copyTo.ObsoletedIn = (Version?)copyFrom.ObsoletedIn?.Clone(); + copyTo.Obsoleted = (Version?)copyFrom.Obsoleted?.Clone(); copyTo.ObsoletedMessage = copyFrom.ObsoletedMessage; copyTo.ObsoletedUrl = copyFrom.ObsoletedUrl; return copyTo; @@ -1829,13 +1829,13 @@ static void MergePlatformAttributes(ImmutableArray immediateAttri } } - if (childAttribute.ObsoletedIn != null && - (childAttribute.ObsoletedIn < existing.UnsupportedFirst || + if (childAttribute.Obsoleted != null && + (childAttribute.Obsoleted < existing.UnsupportedFirst || existing.SupportedFirst != null && - (existing.UnsupportedSecond == null || existing.UnsupportedSecond > childAttribute.ObsoletedIn)) && - (existing.ObsoletedIn == null || childAttribute.ObsoletedIn < existing.ObsoletedIn)) + (existing.UnsupportedSecond == null || existing.UnsupportedSecond > childAttribute.Obsoleted)) && + (existing.Obsoleted == null || childAttribute.Obsoleted < existing.Obsoleted)) { - existing.ObsoletedIn = childAttribute.ObsoletedIn; + existing.Obsoleted = childAttribute.Obsoleted; existing.ObsoletedMessage = childAttribute.ObsoletedMessage; existing.ObsoletedUrl = childAttribute.ObsoletedMessage; } @@ -1896,10 +1896,10 @@ static void MergePlatformAttributes(ImmutableArray immediateAttri // Check for Obsoleted attributes, only lower version could overwrite if (childAttributes.TryGetValue(platform, out var childAttr) && - childAttr.ObsoletedIn != null && - (attributes.ObsoletedIn == null || childAttr.ObsoletedIn < attributes.ObsoletedIn)) + childAttr.Obsoleted != null && + (attributes.Obsoleted == null || childAttr.Obsoleted < attributes.Obsoleted)) { - attributes.ObsoletedIn = childAttr.ObsoletedIn; + attributes.Obsoleted = childAttr.Obsoleted; attributes.ObsoletedMessage = childAttr.ObsoletedMessage; attributes.ObsoletedUrl = childAttr.ObsoletedUrl; } @@ -2110,7 +2110,7 @@ private static bool AddAttribute(AttributeData attribute, Version version, Versi } else { - Debug.Assert(name == ObsoletedInOSPlatformAttribute); + Debug.Assert(name == ObsoletedOSPlatformAttribute); AddOrUpdateObsoletedAttribute(attribute, attributes, version); } @@ -2121,19 +2121,19 @@ static void AddOrUpdateObsoletedAttribute(AttributeData attribute, Versions attr var message = PopulateMessage(attribute); var url = PopulateUrl(attribute); - if (attributes.ObsoletedIn != null) + if (attributes.Obsoleted != null) { // only keep lowest version, ignore other versions - if (attributes.ObsoletedIn > version) + if (attributes.Obsoleted > version) { - attributes.ObsoletedIn = version; + attributes.Obsoleted = version; attributes.ObsoletedMessage = message; attributes.ObsoletedUrl = url; } } else { - attributes.ObsoletedIn = version; + attributes.Obsoleted = version; attributes.ObsoletedMessage = message; attributes.ObsoletedUrl = url; } diff --git a/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.ObsoletedInOSPlatformTests.cs b/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.ObsoletedOSPlatformTests.cs similarity index 90% rename from src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.ObsoletedInOSPlatformTests.cs rename to src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.ObsoletedOSPlatformTests.cs index d0f0655a37..c841e2f33a 100644 --- a/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.ObsoletedInOSPlatformTests.cs +++ b/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.ObsoletedOSPlatformTests.cs @@ -31,14 +31,14 @@ public void M1() {|CA1422:ObsoletedOnLinux4AndWindows10()|}; // This call site is reachable on: 'Linux'. 'Test.ObsoletedOnLinux4AndWindows10()' is obsoleted on: 'Linux' 4.1 and later. } - [ObsoletedInOSPlatform(""Linux4.1"")] + [Mock.ObsoletedOSPlatform(""Linux4.1"")] public void ObsoletedOnLinux4() { } - [ObsoletedInOSPlatform(""Windows10.1.1.1"")] + [Mock.ObsoletedOSPlatform(""Windows10.1.1.1"")] public void ObsoletedOnWindows10() { } - [ObsoletedInOSPlatform(""Linux4.1"", ""Use Linux4Supported"")] - [ObsoletedInOSPlatform(""Windows10.1.1.1"",""Use Windows10Supported"")] + [Mock.ObsoletedOSPlatform(""Linux4.1"", ""Use Linux4Supported"")] + [Mock.ObsoletedOSPlatform(""Windows10.1.1.1"",""Use Windows10Supported"")] public void ObsoletedOnLinux4AndWindows10() { } }" + MockObsoletedAttributeCS; await VerifyAnalyzerCSAsync(csSource, VerifyCS.Diagnostic(PlatformCompatibilityAnalyzer.ObsoletedCsReachable).WithLocation(0) @@ -56,11 +56,11 @@ Public Sub M1() {|#0:ObsoletedOnLinux()|} ' This call site is reachable on: 'Linux'. 'Public Sub ObsoletedOnLinux()' is obsoleted on: 'Linux' 4.1 and later. End Sub - + Public Sub ObsoletedOnWindows10() End Sub - + Public Sub ObsoletedOnLinux() End Sub End Class @@ -113,7 +113,7 @@ public void WindowsOnly() } [SupportedOSPlatform(""Windows8.0"")] - [ObsoletedInOSPlatform(""Windows10.0"")] + [Mock.ObsoletedOSPlatform(""Windows10.0"")] [Mock.UnsupportedOSPlatform(""Windows11.0"")] public void Supported8Obsoleted10Unsupported11() { } } @@ -121,14 +121,14 @@ public void Supported8Obsoleted10Unsupported11() { } [SupportedOSPlatform(""Windows10.0"")] public class Supported10 { - [ObsoletedInOSPlatform(""Windows11.0"")] + [Mock.ObsoletedOSPlatform(""Windows11.0"")] [Mock.UnsupportedOSPlatform(""Windows12.0"")] public static void Obsoleted11Unsupported12() { } - [ObsoletedInOSPlatform(""Windows11.0"")] + [Mock.ObsoletedOSPlatform(""Windows11.0"")] public static void Obsoleted11() { } - [ObsoletedInOSPlatform(""Windows12.0"")] + [Mock.ObsoletedOSPlatform(""Windows12.0"")] [Mock.UnsupportedOSPlatform(""Windows11.0"")] public static void Unsupported11Obsoleted12() { } } @@ -136,22 +136,22 @@ public static void Unsupported11Obsoleted12() { } [SupportedOSPlatform(""Windows8.0"")] public class UnsupportedSupported8 { - [Mock.ObsoletedInOSPlatform(""Windows10.0"")] + [Mock.ObsoletedOSPlatform(""Windows10.0"")] public static void Obsoleted10() { } - [Mock.ObsoletedInOSPlatform(""Linux"")] - [Mock.ObsoletedInOSPlatform(""Windows10.0"")] + [Mock.ObsoletedOSPlatform(""Linux"")] + [Mock.ObsoletedOSPlatform(""Windows10.0"")] public static void ObsoletedWindows10Linux() { } - [Mock.ObsoletedInOSPlatform(""Windows10.0"")] + [Mock.ObsoletedOSPlatform(""Windows10.0"")] [Mock.UnsupportedOSPlatform(""Windows11.0"")] public static void Obsoleted10Unspported11() { } } [Mock.UnsupportedOSPlatform(""Windows"")] public class Unsupported { - [Mock.ObsoletedInOSPlatform(""Linux"")] - [Mock.ObsoletedInOSPlatform(""Windows10.0"")] + [Mock.ObsoletedOSPlatform(""Linux"")] + [Mock.ObsoletedOSPlatform(""Windows10.0"")] public static void Obsoleted1Windows10Linux() { } } " + MockObsoletedAttributeCS; @@ -175,11 +175,11 @@ public void CrossPlatform() {|#2:ObsoletedWithUrl()|}; // This call site is reachable on all platforms. 'Test.ObsoletedWithUrl()' is obsoleted on: 'Windows' 10.1.1.1 and later (http://www/look.for.more.info). } - [ObsoletedInOSPlatform(""Windows10.1.1.1"", Url = ""http://www/look.for.more.info"")] + [Mock.ObsoletedOSPlatform(""Windows10.1.1.1"", Url = ""http://www/look.for.more.info"")] public void ObsoletedWithUrl() { } - [ObsoletedInOSPlatform(""Windows10.1.1.1"", ""Use other method instead"", Url = ""http://www/look.for.more.info"")] + [Mock.ObsoletedOSPlatform(""Windows10.1.1.1"", ""Use other method instead"", Url = ""http://www/look.for.more.info"")] public void ObsoletedWithMessageAndUrl() { } - [ObsoletedInOSPlatform(""Windows10.1.1.1"", ""Use other method instead"")] + [Mock.ObsoletedOSPlatform(""Windows10.1.1.1"", ""Use other method instead"")] public void ObsoletedWithMessage() { } }" + MockObsoletedAttributeCS; await VerifyAnalyzerCSAsync(csSource, s_msBuildPlatforms, VerifyCS.Diagnostic(PlatformCompatibilityAnalyzer.ObsoletedCsAllPlatforms).WithLocation(0). @@ -226,8 +226,8 @@ public void NotSuppressedByCallsiteUnsupported() // obsoleted before unsupported {|CA1422:ObsoletedOnIOS14()|}; // This call site is reachable on: 'ios' 15.0 and before, 'maccatalyst' 15.0 and before. 'Test.ObsoletedOnIOS14()' is obsoleted on: 'ios' 14.0 and later, 'maccatalyst' 14.0 and later. } - [ObsoletedInOSPlatform(""ios13.0"")] - [ObsoletedInOSPlatform(""Windows10.1.0"")] + [Mock.ObsoletedOSPlatform(""ios13.0"")] + [Mock.ObsoletedOSPlatform(""Windows10.1.0"")] public void SuppressedByCallsiteObsoleted() { ObsoletedOnWindows(); // All calls Obsoleted within version range, not warn @@ -235,8 +235,8 @@ public void SuppressedByCallsiteObsoleted() ObsoletedOnIOS14(); } - [ObsoletedInOSPlatform(""ios16.0"")] - [ObsoletedInOSPlatform(""Windows11.1.0"")] + [Mock.ObsoletedOSPlatform(""ios16.0"")] + [Mock.ObsoletedOSPlatform(""Windows11.1.0"")] public void NotSuppressedByCallsiteObsoleted() { {|CA1422:ObsoletedOnWindows()|}; //This call site is reachable on all platforms. 'Test.ObsoletedOnWindows()' is obsoleted on: 'Windows' 10.1.1.1 and later. @@ -244,12 +244,12 @@ public void NotSuppressedByCallsiteObsoleted() {|CA1422:ObsoletedOnIOS14()|}; // This call site is reachable on all platforms. 'Test.ObsoletedOnIOS14()' is obsoleted on: 'ios' 14.0 and later, 'maccatalyst' 14.0 and later. } - [ObsoletedInOSPlatform(""ios14.0"")] + [Mock.ObsoletedOSPlatform(""ios14.0"")] public void ObsoletedOnIOS14() { } - [ObsoletedInOSPlatform(""Windows10.1.1.1"")] + [Mock.ObsoletedOSPlatform(""Windows10.1.1.1"")] public void ObsoletedOnWindows() { } - [ObsoletedInOSPlatform(""Windows10.1.1.1"", ""Use other method instead"")] + [Mock.ObsoletedOSPlatform(""Windows10.1.1.1"", ""Use other method instead"")] public void ObsoletedWithMessage() { } }" + MockObsoletedAttributeCS; await VerifyAnalyzerCSAsync(csSource, s_msBuildPlatforms); @@ -326,14 +326,14 @@ public void CrossPlatform() } } - [ObsoletedInOSPlatform(""Android21.0"")] + [Mock.ObsoletedOSPlatform(""Android21.0"")] public void ObsoletedOnAndroid21() { } - [ObsoletedInOSPlatform(""MacOS"")] + [Mock.ObsoletedOSPlatform(""MacOS"")] public void ObsoletedOnMacOS() { } - [ObsoletedInOSPlatform(""Linux4.1"", ""Use Linux4Supported"")] - [ObsoletedInOSPlatform(""Windows10.1.1.1"",""Use Windows10Supported"")] + [Mock.ObsoletedOSPlatform(""Linux4.1"", ""Use Linux4Supported"")] + [Mock.ObsoletedOSPlatform(""Windows10.1.1.1"",""Use Windows10Supported"")] public void ObsoletedOnLinux4AndWindows10() { } }" + MockObsoletedAttributeCS; await VerifyAnalyzerCSAsync(csSource, s_msBuildPlatforms); @@ -384,14 +384,14 @@ public void AndroidMacOSOnly() } } - [ObsoletedInOSPlatform(""Android21.0"")] + [Mock.ObsoletedOSPlatform(""Android21.0"")] public void ObsoletedOnAndroid21() { } - [ObsoletedInOSPlatform(""MacOS"")] + [Mock.ObsoletedOSPlatform(""MacOS"")] public void ObsoletedOnMacOS() { } - [ObsoletedInOSPlatform(""Linux4.1"", ""Use Linux4Supported"")] - [ObsoletedInOSPlatform(""Windows10.1.1.1"",""Use Windows10Supported"")] + [Mock.ObsoletedOSPlatform(""Linux4.1"", ""Use Linux4Supported"")] + [Mock.ObsoletedOSPlatform(""Windows10.1.1.1"",""Use Windows10Supported"")] public void ObsoletedOnLinux4AndWindows10() { } }" + MockObsoletedAttributeCS; await VerifyAnalyzerCSAsync(csSource, s_msBuildPlatforms); @@ -441,14 +441,14 @@ public void CrossPlatform() } } - [ObsoletedInOSPlatform(""MacOS15.0"")] + [Mock.ObsoletedOSPlatform(""MacOS15.0"")] public void ObsoletedOnMacOS15() { } - [ObsoletedInOSPlatform(""MacOS"")] + [Mock.ObsoletedOSPlatform(""MacOS"")] public void ObsoletedOnMacOS() { } - [ObsoletedInOSPlatform(""Linux"", ""Use LinuxSupported"")] - [ObsoletedInOSPlatform(""Windows10.1.1.1"",""Use Windows10Supported"")] + [Mock.ObsoletedOSPlatform(""Linux"", ""Use LinuxSupported"")] + [Mock.ObsoletedOSPlatform(""Windows10.1.1.1"",""Use Windows10Supported"")] public void ObsoletedOnLinuxAndWindows10() { } }" + MockObsoletedAttributeCS; await VerifyAnalyzerCSAsync(csSource, s_msBuildPlatforms); @@ -502,12 +502,12 @@ public UnsupportedOSPlatformAttribute(string platformName, string message) : bas AttributeTargets.Property | AttributeTargets.Struct, AllowMultiple = true, Inherited = false)] - public sealed class ObsoletedInOSPlatformAttribute : OSPlatformAttribute + public sealed class ObsoletedOSPlatformAttribute : OSPlatformAttribute { - public ObsoletedInOSPlatformAttribute(string platformName) : base(platformName) + public ObsoletedOSPlatformAttribute(string platformName) : base(platformName) { } - public ObsoletedInOSPlatformAttribute(string platformName, string message) : base(platformName) + public ObsoletedOSPlatformAttribute(string platformName, string message) : base(platformName) { Message = message; } @@ -526,7 +526,7 @@ AttributeTargets.Method Or AttributeTargets.[Module] Or AttributeTargets.[Property] Or AttributeTargets.Struct, AllowMultiple:=True, Inherited:=False)> - Public NotInheritable Class ObsoletedInOSPlatformAttribute + Public NotInheritable Class ObsoletedOSPlatformAttribute Inherits Attribute Public Sub New(ByVal platformName As String)